k8s etcd 运行错误 failed to find plugin “flannel“ in path [/usr/lib/cni]

表现形式为 coredns 一直处于 ContainerCreating 状态

shell 复制代码
root@master-node:~# kubectl -n kube-system get pod
NAME                                  READY   STATUS              RESTARTS   AGE
coredns-66bc5c9577-bg6r2              0/1     ContainerCreating   0          4m19s
coredns-66bc5c9577-zgrxl              0/1     ContainerCreating   0          4m19s
etcd-master-node                      1/1     Running             0          4m28s
kube-apiserver-master-node            1/1     Running             0          4m28s
kube-controller-manager-master-node   1/1     Running             0          4m28s
kube-proxy-k28lq                      1/1     Running             0          4m20s
kube-scheduler-master-node            1/1     Running             0          4m28s

describe 可以看到一些错误的事件

shell 复制代码
Events:
  Type     Reason                  Age                 From               Message
  ----     ------                  ----                ----               -------
  Warning  FailedScheduling        4m33s               default-scheduler  0/1 nodes are available: 1 node(s) had untolerated taint {node.kubernetes.io/not-ready: }. no new claims to deallocate, preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.
  Normal   Scheduled               97s                 default-scheduler  Successfully assigned kube-system/coredns-66bc5c9577-bg6r2 to master-node
  Warning  FailedCreatePodSandBox  96s                 kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "9d01df1e999793e5efa68228832ca7288668866636f933b46db5db7cae5a264d": plugin type="flannel" failed (add): failed to find plugin "flannel" in path [/usr/lib/cni]

检查发现 /usr/lib/cni 目录下确实没有 flannel 插件,查询之后看到 flannel 在 /opt/cni/bin 位置,这个可能就是问题的根源,我并没有明确安装部署 flannel 可能是其他服务无意间下载到了这个目录

shell 复制代码
root@master-node:/usr/lib/cni# ls
bandwidth  bridge  dhcp  firewall  host-device  host-local  ipvlan  loopback  macvlan  portmap  ptp  sbr  static  tuning  vlan  vrf
r
shell 复制代码
root@master-node:/opt/cni/bin# ls
bandwidth  bridge  dhcp  dummy  firewall  flannel  host-device  host-local  ipvlan  LICENSE  loopback  macvlan  portmap  ptp  README.md  sbr  static  tap  tuning  vlan  vrf
r

解决方案创建符号链接

shell 复制代码
sudo ln -sf /opt/cni/bin/* /usr/lib/cni/

如果你没有 cni,还是需要下载的。

相关推荐
万博智云OneProCloud10 分钟前
GPU 资源池化最佳实践:规划、调度、监控与运营的五步方法
kubernetes·算力调度·ai基础设施·gpu池化·agione·powerone
LBL12207 小时前
内网容器部署FTP日志监控服务
运维·服务器·容器
溜达的大象9 小时前
极空间部署Traggo时间追踪工具:Docker安装、标签管理与cpolar远程访问
运维·docker·容器
脏脏a9 小时前
极空间部署 Dashlet:Docker 搭建私人导航仪表盘,再配置固定公网访问
运维·docker·容器
User_芊芊君子10 小时前
Prometheus接入Pushgateway实战:二进制与Docker部署、指标推送及远程上报
docker·容器·prometheus
江湖有缘11 小时前
3款开源日记工具整理合集,可Docker一键部署!
docker·容器·开源
Thneonl1 天前
Flink Operator 的隐藏陷阱:容器名不是你以为的那个
安全·kubernetes
Thneonl1 天前
kubectl scale ds 是个 404:DaemonSet 没有 replicas
安全·kubernetes
穷人小水滴1 天前
用容器编译 VirtualBox 虚拟机软件 (ArchLinux, podman)
linux·容器·virtualbox
暗不需求1 天前
Docker 入门:从「光盘与 DVD」到全栈项目容器化实战
docker·容器·面试