kubeadm reset 环境及网络清理

RunPodSandbox from runtime service failed: rpc error: code = 2 desc = NetworkPlugin cni failed to set up pod "kube-dns-86f4d74b45-ffwjf" network: failed to set bridge addr: "cni0" already has an IP address different from 10.244.4.1/24


"CreatePodSandbox for pod \" kube-dns-86f4d74b45-ffwjf _default(78e796f5-e
b7c-11e7-b903-b827ebd42d30)\" failed: rpc error: code = Unknown desc = N
etworkPlugin cni failed to set up pod \" kube-dns-86f4d74b45-ffwjf _default\"
network: failed to allocate for range 0: no IP addresses available in range set:
10.244.1.1-10.244.1.254"

确保集群初始化时ip地址不和现有网络子网冲突, 请使用–pod-network-cidr=10.88.99.0/24更改pod子网范围

 

使用kubeadm reset重置集群

#在master节点之外的节点进行操作
kubeadm reset
systemctl stop kubelet
systemctl stop docker
rm -rf /var/lib/cni/
rm -rf /var/lib/kubelet/*
rm -rf /etc/cni/
ifconfig cni0 down
ifconfig flannel.1 down
ifconfig docker0 down
ip link delete cni0
ip link delete flannel.1
##重启kubelet
systemctl restart kubelet
##重启docker
systemctl restart docker

 

CNI 网络错误,一般需要检查 CNI 网络插件的配置,比如:
(1)无法配置 Pod 网络
(2)无法分配 IP 地址
容器无法启动,需要检查是否打包了正确的镜像或者是否配置了正确的容器参数等。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

昵称 *