解决kubernetes问题:failed to find plugin "portmap" in path [/opt/cni/bin]]

安装kubernetes之后,使用

kubectl get pod --all namespaces

查看所有pod,发现coredns的pod一直处于create的状态

使用命令查看

kubectl describe pod coredns-5c98db65d4-xxb6z -n kube-system

发现此pod报错为:

Warning  FailedCreatePodSandBox  74s               kubelet, node1  Failed create pod sandbox: rpc error: code = Unknown desc = [failed to set up sandbox container "79be600e4f1711672f9c42d6b1b03202d4a0682fb3175a0be99d976d0b01a4af" network for pod "coredns-5c98db65d4-xxb6z": NetworkPlugin cni failed to set up pod "coredns-5c98db65d4-xxb6z_kube-system" network: failed to find plugin "loopback" in path [/opt/cni/bin], failed to clean up sandbox container "79be600e4f1711672f9c42d6b1b03202d4a0682fb3175a0be99d976d0b01a4af" network for pod "coredns-5c98db65d4-xxb6z": NetworkPlugin cni failed to teardown pod "coredns-5c98db65d4-xxb6z_kube-system" network: failed to find plugin "portmap" in path [/opt/cni/bin]]

检查/opt/cni/bin目录下,发现没有文件,

于是执行

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF

yum clean all
yum install kubernetes-cni -y

之后,检查/opt/cni/bin目录下,已经有文件,并且coredns能够正常执行,于是问题解决。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值