删除node节点 删除通过csr请求后产生的所有文件和证书 [[email protected] ~]# rm -rf /etc/kubernetes/kubelet.conf [[email protected] ~]# rm -rf /etc/kubernetes/pki/kubelet* 重启所有节点的kubelet [[email protected] ~]# systemctl restart kubelet 获取csr [[email protected] ~]# kubectl get csr NAME AGE REQUESTOR CONDITION node-csr-W8jDxg0LEZZw6U8V1WudhEBRP0qt4ybPSJ-P8XfDzlo 7s kubelet-bootstrap Pending node-csr-rgnoMPuDdtvfoogsY_zbf1R3KMU_B8M8cBv75AHw8fE 10s kubelet-bootstrap Pending node-csr-vO6qQvzlI974qUHXVpPu6kMP4eBfKMcBECwqY7xWYu4 17s kubelet-bootstrap Pending 通过证书请求 [[email protected] ~]# kubectl certificate approve node-csr-W8jDxg0LEZZw6U8V1WudhEBRP0qt4ybPSJ-P8XfDzlo [[email protected] ~]# kubectl certificate approve node-csr-rgnoMPuDdtvfoogsY_zbf1R3KMU_B8M8cBv75AHw8fE [[email protected] ~]# kubectl certificate approve node-csr-vO6qQvzlI974qUHXVpPu6kMP4eBfKMcBECwqY7xWYu4 5、设置角色 [[email protected] ~]# kubectl label nodes lab1 node-role.kubernetes.io/master= [[email protected] ~]# [[email protected] ~]# kubectl label nodes lab2 node-role.kubernetes.io/node= node/lab2 labeled [[email protected] ~]# kubectl label nodes lab3 node-role.kubernetes.io/node= node/lab3 labeled [[email protected] ~]# kubectl get nodes NAME STATUS ROLES AGE VERSION lab1 Ready <none> 15m v1.11.0 lab2 Ready <none> 14m v1.11.0 lab3 Ready <none> 14m v1.11.0 6、解决后遗症 执行: [[email protected] coredns]# kubectl delete -f coredns.yaml 现象: [[email protected] k8s]# kubectl get pods -n kube-system NAME READY STATUS RESTARTS AGE coredns-6c65fc5cbb-7xvzs 0/1 ContainerCreating 0 2m coredns-6c65fc5cbb-kh4zg 0/1 ContainerCreating 0 2m 原因: 修改node名称后的遗留症状 查看pod日志,最后部分 [[email protected] k8s]# kubectl describe po coredns-6c65fc5cbb-7xvzs -n kube-system "cni0" already has an IP address different from 10.244.5.1/24 解决: 所有节点执行如下: rm -rf /var/lib/cni/flannel/* && rm -rf /var/lib/cni/networks/cbr0/* && ip link delete cni0 rm -rf /var/lib/cni/networks/cni0/* 参照文档: https://my.oschina.net/u/3390908/blog/1649764
原文地址:https://www.cnblogs.com/effortsing/p/10357413.html
时间: 2024-10-02 13:58:52