coredns 一直处于 Pending 或者 ContainerCreating 状态

1. 问题描述

coresdns 状态一直处于 Pending 或者 ContainerCreating 状态

Events:
  Type     Reason                  Age                  From                              Message
  ----     ------                  ----                 ----                              -------
  Warning  FailedScheduling        11m (x6 over 16m)    default-scheduler                 0/1 nodes are available: 1 node(s) had taints that the pod didn't tolerate.
  Normal   Scheduled               11m                  default-scheduler                 Successfully assigned kube-system/coredns-5c98db65d4-hb7hd to izm5e3cntl0pztm4dj3phrz
  Warning  FailedCreatePodSandBox  11m                  kubelet, izm5e3cntl0pztm4dj3phrz  Failed create pod sandbox: rpc error: code = Unknown desc = [failed to set up sandbox container "fc6ab00e36704719d84c6d8e7cb9135d10b5d255f290b379678a3df1b312c246" network for pod "coredns-5c98db65d4-hb7hd": NetworkPlugin cni failed to set up pod "coredns-5c98db65d4-hb7hd_kube-system" network: failed to find plugin "loopback" in path [/opt/cni/bin], failed to clean up sandbox container "fc6ab00e36704719d84c6d8e7cb9135d10b5d255f290b379678a3df1b312c246" network for pod "coredns-5c98db65d4-hb7hd": NetworkPlugin cni failed to teardown pod "coredns-5c98db65d4-hb7hd_kube-system" network: failed to find plugin "portmap" in path [/opt/cni/bin]]
  Normal   SandboxChanged          102s (x48 over 11m)  kubelet, izm5e3cntl0pztm4dj3phrz  Pod sandbox changed, it will be killed and re-created.

coredns会一直处于ContainerCreating状态,从事件中可以看出,是因为bin文件还没有。

 network: failed to find plugin "loopback" in path [/opt/cni/bin]
2. 解决方法

安装cni,此处以flannel 为例

1. mkdir -p $GOPATH/src/github.com/containernetworking/plugins

2. git clone https://github.com/containernetworking/plugins.git

3. ./build_linux.sh

4. 如果 /opt/cni/bin 不存在
   mkdir -p /opt/cni/bin
   cp bin/* /opt/cni/bin

5. ls bin/
   bandwidth  dhcp      flannel      host-local  loopback  portmap  sbr     tuning
   bridge     firewall  host-device  ipvlan      macvlan   ptp      static  vlan
Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐