我使用kubeadm init
初始化了Kubernetes,在我使用kubeadm reset
重置它之后,我发现--pod-network-cidr
错了。在纠正之后,我尝试使用kubeadm
再次初始化Kubernetes:
kubeadm init --use-kubernetes-version v1.5.1 --external-etcd endpoints=http://10.111.125.131:2379 --pod-network-cidr=10.244.0.0/16
然后我在节点上出现了一些错误
12月 28 15:30:55 ydtf-node-137 kubelet[13333]: E1228 15:30:55.838700 13333 cni.go:255] Error adding network: no IP addresses available in network: cbr0
12月 28 15:30:55 ydtf-node-137 kubelet[13333]: E1228 15:30:55.838727 13333 cni.go:209] Error while adding to cni network: no IP addresses available in network: cbr0
12月 28 15:30:55 ydtf-node-137 kubelet[13333]: E1228 15:30:55.838781 13333 docker_manager.go:2201] Failed to setup network for pod "test-701078429-tl3j2_default(6945191b-ccce-11e6-b53d-78acc0f9504e)" using network plugins "cni": no IP addresses available in network: cbr0; Skipping pod
12月 28 15:30:56 ydtf-node-137 kubelet[13333]: E1228 15:30:56.205596 13333 pod_workers.go:184] Error syncing pod 6945191b-ccce-11e6-b53d-78acc0f9504e, skipping: failed to "SetupNetwork" for "test-701078429-tl3j2_default" with SetupNetworkError: "Failed to setup network for pod \"test-701078429-tl3j2_default(6945191b-ccce-11e6-b53d-78acc0f9504e)\" using network plugins \"cni\": no IP addresses available in network: cbr0; Skipping pod"
或
Dec 29 10:20:02 ydtf-node-137 kubelet: E1229 10:20:02.065142 22259 pod_workers.go:184] Error syncing pod 235cd9c6-cd6c-11e6-a9cd-78acc0f9504e, skipping: failed to "SetupNetwork" for "test-701078429-zmkdf_default" with SetupNetworkError: "Failed to setup network for pod \"test-701078429-zmkdf_default(235cd9c6-cd6c-11e6-a9cd-78acc0f9504e)\" using network plugins \"cni\": \"cni0\" already has an IP address different from 10.244.1.1/24; Skipping pod"
为什么我不能为新播客创建网络?
顺便说一句,我使用法兰绒作为网络提供商,它运作良好。
[root@ydtf-master-131 k8s151]# kubectl get pods --all-namespaces -o wide
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE
default test-701078429-tl3j2 0/1 ContainerCreating 0 2h <none> ydtf-node-137
kube-system dummy-2088944543-hd7b7 1/1 Running 0 2h 10.111.125.131 ydtf-master-131
kube-system kube-apiserver-ydtf-master-131 1/1 Running 7 2h 10.111.125.131 ydtf-master-131
kube-system kube-controller-manager-ydtf-master-131 1/1 Running 0 2h 10.111.125.131 ydtf-master-131
kube-system kube-discovery-1769846148-bjgp8 1/1 Running 0 2h 10.111.125.131 ydtf-master-131
kube-system kube-dns-2924299975-q8x2m 4/4 Running 0 2h 10.244.0.3 ydtf-master-131
kube-system kube-flannel-ds-3fsjh 2/2 Running 0 2h 10.111.125.137 ydtf-node-137
kube-system kube-flannel-ds-89r72 2/2 Running 0 2h 10.111.125.131 ydtf-master-131
kube-system kube-proxy-7w8c4 1/1 Running 0 2h 10.111.125.137 ydtf-node-137
kube-system kube-proxy-jk6z6 1/1 Running 0 2h 10.111.125.131 ydtf-master-131
kube-system kube-scheduler-ydtf-master-131 1/1 Running 0 2h 10.111.125.131 ydtf-master-131
答案 0 :(得分:9)
我弄明白,如果你在通过 kubeadm init 重新初始化kubernetes时更改 - pod-network-cidr ,你应该删除一些自动创建的东西,只是在再次执行 kubeadm init 之前,请按照以下步骤操作:
在主服务器和节点上执行 Kubeadm reset 。
在etcd中执行 etcdctl rm --recursive registry 重置数据。
现在,我的kubernets运行良好:)
答案 1 :(得分:1)
在 kubeadm重置之后和 kubeadm init 之前,在主节点和工作节点上执行以下操作:
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
和ip link delete cni0
ifconfig flannel.1 down
和ip link delete flannel.1
ifconfig docker0 down
使用 kubernetes服务器版本进行了测试:v1.13.2
和法兰绒:
v0.10.0-amd64
答案 2 :(得分:1)
什么对我有用:
ip链接将cni0设置为关闭
brctl delbr cni0
删除并重新应用法兰绒
因此无需再次建立集群
答案 3 :(得分:0)
我遇到了类似的问题,在这种情况下的解决方法是将法兰绒吊舱网络应用到群集中:
wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
kubectl apply -f kube-flannel.yml
答案 4 :(得分:0)
该文档对您有很大帮助:
https://github.com/feiskyer/kubernetes-handbook/blob/master/en/troubleshooting/pod.md
特别是适用于此问题的部分:
$ ip link set cni0 down
$ brctl delbr cni0
如果您在api服务器上执行此操作,然后重新启动计算机,它将很快稳定下来。