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创建失败。 

  1. Warning FailedCreatePodSandBox 20s (x12 over 54s) kubelet, tensorflow0 Failed create pod sandbox.

  2. 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

猜你喜欢

转载自blog.csdn.net/ccy19910925/article/details/80860639