我正在尝试在 ubuntu/impish64 上运行 k8s。我有一个成功运行 ubuntu/bionic 的参考环境。环境之间的唯一区别是 ubuntu 映像和 ip 地址范围
这是 Bionic 的输出:
vagrant@ubuntu-bionic:~$ kubectl get pods -n kube-system -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
coredns-64897985d-bk74z 1/1 Running 2 (3d2h ago) 4d8h 10.244.0.6 machine1 <none> <none>
coredns-64897985d-jhghl 1/1 Running 2 (3d2h ago) 4d8h 10.244.0.7 machine1 <none> <none>
etcd-machine1 1/1 Running 2 (3d2h ago) 4d8h 192.168.33.20 machine1 <none> <none>
kube-apiserver-machine1 1/1 Running 2 (3d2h ago) 4d8h 192.168.33.20 machine1 <none> <none>
kube-controller-manager-machine1 1/1 Running 2 (3d2h ago) 4d8h 192.168.33.20 machine1 <none> <none>
kube-flannel-ds-7c6mh 1/1 Running 2 (3d2h ago) 4d8h 192.168.33.20 machine1 <none> <none>
kube-proxy-r982l 1/1 Running 2 (3d2h ago) 4d8h 192.168.33.20 machine1 <none> <none>
kube-scheduler-machine1 1/1 Running 2 (3d2h ago) 4d8h 192.168.33.20 machine1 <none> <none>
这是顽皮的输出:
vagrant@ubuntu-impish:~$ kubectl get pods -n kube-system -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
coredns-64897985d-bd47f 0/1 Pending 0 45m <none> <none> <none> <none>
coredns-64897985d-s9bct 0/1 Pending 0 45m <none> <none> <none> <none>
etcd-machine1 1/1 Running 0 45m 10.0.2.15 machine1 <none> <none>
kube-apiserver-machine1 1/1 Running 0 45m 10.0.2.15 machine1 <none> <none>
kube-controller-manager-machine1 1/1 Running 0 45m 10.0.2.15 machine1 <none> <none>
kube-proxy-2sknk 1/1 Running 0 45m 10.0.2.15 machine1 <none> <none>
kube-scheduler-machine1 1/1 Running 0 45m 10.0.2.15 machine1 <none> <none>
两个潜在的线索是:
Jan 21 09:22:21 ubuntu-impish kubelet[8744]: I0121 09:22:21.657003 8744 cni.go:240] "Unable to update cni config" err="no networks found in /etc/cni/net.d"
Jan 21 09:22:24 ubuntu-impish kubelet[8744]: E0121 09:22:24.425056 8744 kubelet.go:2347] "Container runtime network not ready" networkReady="NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized"
尝试安装 flannel 失败,出现以下情况:
vagrant@ubuntu-impish:~$ sudo kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
The connection to the server localhost:8080 was refused - did you specify the right host or port?
有什么建议么?
答案1
在评论之外发布答案。
答案很简短:
sudo
最后一个命令应该在没有为用户创建kubectl
上下文的情况下执行root
。
您可以办理登机config
手续~/.kube/config