Use context: kubectl config use-context k8s-c3-CCC

Your coworker said node cluster3-node2 is running an older Kubernetes version and is not even part of the cluster. Update Kubernetes on that node to the exact version that's running on cluster3-controlplane1 . Then add this node to the cluster. Use kubeadm for this.


译文:

你的同事说 cluster3-node2 节点运行的是旧的Kubernetes版本,甚至不是集群的一部分。将该节点上的Kubernetes更新为 cluster3-controlplane1 上运行的确切版本。使用kubeadm把这个节点添加到集群中。


解答:

参考: https://kubernetes.io/zh-cn/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/

kubectl config use-context k8s-c3-CCC

检查节点

k get node

连接到远程node2,检查kubeadm, kubelet,kubectl 情况

ssh cluster3-node2
root@cluster3-node2:~# kubeadm version
root@cluster3-node2:~# kubectl version --short
root@cluster3-node2:~# kubelet --version

更新 kubelet,kubectl到1.26.0-00

root@cluster3-node2:~# apt update
root@cluster3-node2:~# apt show kubectl -a | grep 1.26
root@cluster3-node2:~# apt install -y kubectl=1.26.0-00 kubelet=1.26.0-00
root@cluster3-node2:~# kubelet --version
root@cluster3-node2:~# systemctl daemon-reload
root@cluster3-node2:~# systemctl restart kubelet

从控制平面获取join 集群命令链接

ssh cluster3-controlplane1
root@cluster3-controlplane1:~# kubeadm token create --print-join-command

file

进入node2节点,把从控制平面获取的join token 执行

ssh cluster3-node2

root@cluster3-node2:~# kubeadm join 192.168.100.31:6443 --token rbhrjh.4o93r31o18an6dll --discovery-token-ca-cert-hash sha256:d94524f9ab1eed84417414c7def5c1608f84dbf04437d9f5f73eb6255dafdb18

file

检查kubelet 状态

systemctl status kubelet

检查集群node

k get node

file


Killer.sh CKA模拟题目 汇总