k8s节点连接不上
"can only access node lease with the same name as the requesting node"错误引起k8s节点状态 NotReady
·
错误日志如下:
8月 25 17:00:37 k8s-node3 kubelet[5491]: E0825 17:00:37.023421 5491 controller.go:136] failed to ensure node lease exists, will retry in 7s, error: leases.coordination.k8s.io "k8s-node3" is forbidden: User "system:node:k8s-node1" cannot get resource "leases" in API group "coordination.k8s.io" in the namespace "kube-node-lease": can only access node lease with the same name as the requesting node
8月 25 17:00:39 k8s-node3 kubelet[5491]: I0825 17:00:39.148315 5491 kubelet_node_status.go:70] Attempting to register node k8s-node3
8月 25 17:00:39 k8s-node3 kubelet[5491]: E0825 17:00:39.150988 5491 kubelet_node_status.go:92] Unable to register node "k8s-node3" with API server: nodes "k8s-node3" is forbidden: node "k8s-node1" is not allowed to modify node "k8s-node3"
错误原因:
节点主机上名称与主节点上不一致
解决方式:
节点上执行:
cp /etc/kubernetes/kubelet.conf /etc/kubernetes/kubelet.conf_bak
主节点上执行:
kubeadm init phase kubeconfig kubelet --node-name 节点名称 --kubeconfig-dir /tmp/ --apiserver-advertise-address 主节点ip
主节点上执行:
scp /tmp/kubelet.conf root@节点ip:/etc/kubernetes/
节点上执行:
systemctl restart kubelet
更多推荐
已为社区贡献2条内容
所有评论(0)