Kubeadm 安裝中的各種坑
一、
error: failed to run Kubelet: failed to create kubelet: misconfiguration: kubelet cgroup driver: "systemd" is different from docker cgroup driver: "cgroupfs"
解決:
vi /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
update KUBELET_CGROUP_ARGS=--cgroup-driver=systemd
to KUBELET_CGROUP_ARGS=--cgroup-driver=cgroupfs
restart kubelet
二、
Unable to connect to the server: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "kubernetes")
解決:export KUBECONFIG=/etc/kubernetes/kubelet.conf
三、Failed to request cluster info, will try again: [Get https://192.168.57.4:6443/api/v1/namespaces/kube-public/configmaps/cluster-info: x509: certificate has expired or is not yet valid]
解決:同步master和node的時間
四、The connection to the server localhost:8080 was refused - did you specify the right host or port?
解決:
export KUBECONFIG=/etc/kubernetes/admin.conf
定義在6443埠 而不是8080
五、runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
解決:
1.刪除/etc/systemd/system/kubelet.service.d/10-kubeadm.conf裡最後一行裡的$KUBELET_NETWORK_ARGS
2.重啟kubelet systemctl enable kubelet && systemctl start kubelet
3.重新加入 kubeadm reset || kubeadm join ….
六、pod ContainerCreating Or Error
default po/httpd-68f9d7648d-5f9gt 0/1 ContainerCreating 0 1m <none> tensorflow0
describe一下 說sadbox建立失敗。
-
Warning FailedCreatePodSandBox 20s (x12 over 54s) kubelet, tensorflow0 Failed create pod sandbox.
-
Normal SandboxChanged 20s (x12 over 53s) kubelet, tensorflow0 Pod sandbox changed, it will be killed and re-created
解決:一般歸結為網路問題,檢視或重啟網路(calico或flanneld)
七、kube-dns 啟動不成功
kube-system po/kube-dns-6f4fd4bdf-p5x4k 0/3 Pending 0 14m
①修改 /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
刪除$KUBELET_NETWORK_ARGS (別這麼做,不推薦)
②dns異常,kubeadm reset重來,試試先初始化master,然後配置calico或flannel網路,ok了以後,再加入其它機器
重啟
systemctl daemon-reload && systemctl restart kubelet
kubeadm reset
kubeadm init --kubernetes-version=v1.9.0 --pod-network-cidr=10.244.0.0/16