美文网首页
记一次所有pod 一直pending问题

记一次所有pod 一直pending问题

作者: wwq2020 | 来源:发表于2022-04-17 18:09 被阅读0次

    背景

    最近做公司项目的客户私有化部署方案的时候,验收一键部署脚本发现所有pod都是pending

    排查

    查看pod状态

    kubectl describe pod -n myns mypod
    

    显示

      Warning  NetworkNotReady   24m (x302 over 34m)  kubelet            network is not ready: container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
    

    查看kubelet日志

    journalctl -u kubelet
    

    发现

    Apr 16 23:28:28 VM-128-221-centos kubelet[17052]: I0416 23:28:28.564264   17052 cni.go:205] "Error validating CNI config list" configList="{\n  \"name\": \"cbr0\",\n  \"cniVersion\": \"0.3.1\",\n  \"plugins\": [\n    {\n      \"type\": \"flannel\",\n      \"delegate\": {\n        \"hairpinMode\": true,\n        \"isDefaultGateway\": true\n      }\n    },\n    {\n      \"type\": \"portmap\",\n      \"capabilities\": {\n        \"portMappings\": true\n      }\n    }\n  ]\n}\n" err="[failed to find plugin \"flannel\" in path [/opt/cni/bin] failed to find plugin \"portmap\" in path [/opt/cni/bin]]"
    

    查看/opt/cni/bin/

    ls /opt/cni/bin/
    

    正常显示如下

    image.png

    实际显示


    image.png

    解决方式

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

    相关文章

      网友评论

          本文标题:记一次所有pod 一直pending问题

          本文链接:https://www.haomeiwen.com/subject/znulertx.html