9、二进制安装K8s之增加node

二进制安装K8s之增加node

1、复制文件,要部署几台就直接复制即可
#二进制文件
scp /data/k8s/bin/{kubelet,kube-proxy}  root@192.168.100.171:/data/k8s/bin/
scp /data/k8s/bin/{kubelet,kube-proxy}  root@192.168.100.172:/data/k8s/bin/
scp /data/k8s/bin/{kubelet,kube-proxy}  root@192.168.100.173:/data/k8s/bin/

# systemd启动文件
scp /usr/lib/systemd/system/{kubelet,kube-proxy}.service root@192.168.100.171:/usr/lib/systemd/system/
scp /usr/lib/systemd/system/{kubelet,kube-proxy}.service root@192.168.100.172:/usr/lib/systemd/system/
scp /usr/lib/systemd/system/{kubelet,kube-proxy}.service root@192.168.100.173:/usr/lib/systemd/system/

#证书
scp  /data/k8s/ssl/ca.pem root@192.168.100.171:/data/k8s/ssl/
scp  /data/k8s/ssl/ca.pem root@192.168.100.172:/data/k8s/ssl/
scp  /data/k8s/ssl/ca.pem root@192.168.100.173:/data/k8s/ssl/

#配置文件
scp /data/k8s/config/{kubelet.conf,kube-proxy.conf,kube-proxy-config.yml,kubelet-config.yml,bootstrap.kubeconfig,kube-proxy.kubeconfig} root@192.168.100.171:/data/k8s/config/

scp /data/k8s/config/{kubelet.conf,kube-proxy.conf,kube-proxy-config.yml,kubelet-config.yml,bootstrap.kubeconfig,kube-proxy.kubeconfig} root@192.168.100.172:/data/k8s/config/

scp /data/k8s/config/{kubelet.conf,kube-proxy.conf,kube-proxy-config.yml,kubelet-config.yml,bootstrap.kubeconfig,kube-proxy.kubeconfig} root@192.168.100.173:/data/k8s/config/ 
2、修个配置文件
  • kubelet.conf 文件里参数修改为当前主机(每一台node都要修改)
--hostname-override=k8s-node01
  • kube-proxy-config.yml修改成当前主机名(每一台node都要修改)
hostnameOverride: k8s-node01
3、启动 并设置开机启动
systemctl daemon-reload
systemctl start kubelet
systemctl enable kubelet
systemctl start kube-proxy
systemctl enable kube-proxy

4、在master 节点查看node加入请求
#显示 Pending 等待批准
kubectl get csr

NAME                                                   AGE     SIGNERNAME                                    REQUESTOR           CONDITION
node-csr-UQklZRQ9iaMS02fZImoMFd8nTjVUJQ4XW8cQR3kf6xE   6m27s   kubernetes.io/kube-apiserver-client-kubelet   kubelet-bootstrap   Pending

#批准授权
kubectl certificate approve node-csr-UQklZRQ9iaMS02fZImoMFd8nTjVUJQ4XW8cQR3kf6xE
certificatesigningrequest.certificates.k8s.io/node-csr-UQklZRQ9iaMS02fZImoMFd8nTjVUJQ4XW8cQR3kf6xE approved

#授权以后再次查看node显示 Ready ,新node 已经成功加入集群
kubectl get nodes
NAME           STATUS   ROLES    AGE    VERSION
k8s-master01   Ready    <none>   162m   v1.20.9
k8s-node01     Ready    <none>   17m    v1.20.9
posted @ 2021-08-21 18:37  小兔几白又白  阅读(264)  评论(0编辑  收藏  举报