代码之家  ›  专栏  ›  技术社区  ›  sfgroups

Kubernetes v1.11.0 ha群集coredns pods未出现

  •  1
  • sfgroups  · 技术社区  · 6 年前

    我尝试在Centos7服务器上创建Kubernetesv1.11.0ha集群。我的主机上禁用了IPv6。

    https://kubernetes.io/docs/setup/independent/high-availability/

    根据这些步骤添加了所有三个主服务器,coredns pod不会出现,它会在/var/log/messages文件中继续记录下面的错误。

    kubectl get pods -n kube-system
    NAME                                READY     STATUS              RESTARTS   AGE
    coredns-78fcdf6894-8t7bt            0/1       ContainerCreating   0          53m
    coredns-78fcdf6894-plmll            0/1       ContainerCreating   0          53m
    

    错误消息:

    Jul 17 10:09:28 master03 kubelet: E0717 10:09:28.531244   10041 remote_runtime.go:92] RunPodSandbox from runtime service failed: rpc error: code = Unknown desc = [failed to set up sandbox container "8cf72126bd4ea7e33806512997d02b51c3f95331701928c52c19d1ddea9d6f9c" network for pod "coredns-78fcdf6894-8t7bt": NetworkPlugin cni failed to set up pod "coredns-78fcdf6894-8t7bt_kube-system" network: open /proc/sys/net/ipv6/conf/eth0/accept_dad: no such file or directory, failed to clean up sandbox container "8cf72126bd4ea7e33806512997d02b51c3f95331701928c52c19d1ddea9d6f9c" network for pod "coredns-78fcdf6894-8t7bt": NetworkPlugin cni failed to teardown pod "coredns-78fcdf6894-8t7bt_kube-system" network: failed to get IP addresses for "eth0": <nil>]
    Jul 17 10:09:28 master03 kubelet: E0717 10:09:28.531286   10041 kuberuntime_sandbox.go:56] CreatePodSandbox for pod "coredns-78fcdf6894-8t7bt_kube-system(7caa3f29-89c3-11e8-aa0f-00505693ca30)" failed: rpc error: code = Unknown desc = [failed to set up sandbox container "8cf72126bd4ea7e33806512997d02b51c3f95331701928c52c19d1ddea9d6f9c" network for pod "coredns-78fcdf6894-8t7bt": NetworkPlugin cni failed to set up pod "coredns-78fcdf6894-8t7bt_kube-system" network: open /proc/sys/net/ipv6/conf/eth0/accept_dad: no such file or directory, failed to clean up sandbox container "8cf72126bd4ea7e33806512997d02b51c3f95331701928c52c19d1ddea9d6f9c" network for pod "coredns-78fcdf6894-8t7bt": NetworkPlugin cni failed to teardown pod "coredns-78fcdf6894-8t7bt_kube-system" network: failed to get IP addresses for "eth0": <nil>]
    Jul 17 10:09:28 master03 kubelet: E0717 10:09:28.531298   10041 kuberuntime_manager.go:646] createPodSandbox for pod "coredns-78fcdf6894-8t7bt_kube-system(7caa3f29-89c3-11e8-aa0f-00505693ca30)" failed: rpc error: code = Unknown desc = [failed to set up sandbox container "8cf72126bd4ea7e33806512997d02b51c3f95331701928c52c19d1ddea9d6f9c" network for pod "coredns-78fcdf6894-8t7bt": NetworkPlugin cni failed to set up pod "coredns-78fcdf6894-8t7bt_kube-system" network: open /proc/sys/net/ipv6/conf/eth0/accept_dad: no such file or directory, failed to clean up sandbox container "8cf72126bd4ea7e33806512997d02b51c3f95331701928c52c19d1ddea9d6f9c" network for pod "coredns-78fcdf6894-8t7bt": NetworkPlugin cni failed to teardown pod "coredns-78fcdf6894-8t7bt_kube-system" network: failed to get IP addresses for "eth0": <nil>]
    Jul 17 10:09:28 master03 kubelet: E0717 10:09:28.531358   10041 pod_workers.go:186] Error syncing pod 7caa3f29-89c3-11e8-aa0f-00505693ca30 ("coredns-78fcdf6894-8t7bt_kube-system(7caa3f29-89c3-11e8-aa0f-00505693ca30)"), skipping: failed to "CreatePodSandbox" for "coredns-78fcdf6894-8t7bt_kube-system(7caa3f29-89c3-11e8-aa0f-00505693ca30)" with CreatePodSandboxError: "CreatePodSandbox for pod \"coredns-78fcdf6894-8t7bt_kube-system(7caa3f29-89c3-11e8-aa0f-00505693ca30)\" failed: rpc error: code = Unknown desc = [failed to set up sandbox container \"8cf72126bd4ea7e33806512997d02b51c3f95331701928c52c19d1ddea9d6f9c\" network for pod \"coredns-78fcdf6894-8t7bt\": NetworkPlugin cni failed to set up pod \"coredns-78fcdf6894-8t7bt_kube-system\" network: open /proc/sys/net/ipv6/conf/eth0/accept_dad: no such file or directory, failed to clean up sandbox container \"8cf72126bd4ea7e33806512997d02b51c3f95331701928c52c19d1ddea9d6f9c\" network for pod \"coredns-78fcdf6894-8t7bt\": NetworkPlugin cni failed to teardown pod \"coredns-78fcdf6894-8t7bt_kube-system\" network: failed to get IP addresses for \"eth0\": <nil>]"
    Jul 17 10:09:28 master03 kubelet: W0717 10:09:28.636173   10041 cni.go:243] CNI failed to retrieve network namespace path: cannot find network namespace for the terminated container "88183d8a24dcafca5b04e3a6454e83aca1417a6934f50cd52b3e6fffbae4f272"
    Jul 17 10:09:28 master03 kernel: XFS (dm-18): Mounting V4 Filesystem
    

    如何修复此错误消息并带来coredns pods?

    谢谢

    4 回复  |  直到 5 年前
        1
  •  0
  •   VAS    6 年前

    有一个问题 Coreos Github 这正好描述了你的情况。解决这个问题的建议是:

    squeed :您使用的是旧版本的CNI,但不起作用 在禁用IPv6的系统上。请重新启用IPv6或升级CNI。

    关于相关问题 CNI Github 他还提到:

    枯萎的 :正如我已经解释过的,这个问题已经解决了6个月。 请升级您的CNI插件。

    jellonek 评论:

    这是您的部署软件提供商的问题,在 你的案子很可能 https://github.com/kubernetes/kubeadm

    但是,如果出于某种原因需要关闭IPv6,则可以使用 addon 库比登斯而不是 CoreDNS 使用 kubeadm :

    kubeadm init--pod网络cidr=192.168.0.0/16--feature gates=coredns=false

    或者您可以删除coredns部署和服务,然后应用kubedns yaml,它应该是 generated 或者调整为实际的集群配置。

    这是来自 deployAddons.sh 负责部署kube dns加载项的文件:

    function deploy_dns {
      echo "Deploying DNS on Kubernetes"
      cp "${KUBE_ROOT}/cluster/addons/dns/kube-dns/kube-dns.yaml.sed" kube-dns.yaml
      sed -i -e "s/\\\$DNS_DOMAIN/${DNS_DOMAIN}/g" kube-dns.yaml
      sed -i -e "s/\\\$DNS_SERVER_IP/${DNS_SERVER_IP}/g" kube-dns.yaml
    
      KUBEDNS=`eval "${KUBECTL} get services --namespace=kube-system | grep kube-dns | cat"`
    
      if [ ! "$KUBEDNS" ]; then
        # use kubectl to create kube-dns addon
        ${KUBECTL} --namespace=kube-system create -f kube-dns.yaml
    
        echo "Kube-dns addon is successfully deployed."
      else
        echo "Kube-dns addon is already deployed. Skipping."
      fi
    
      echo
    }
    
        2
  •  0
  •   김지성    6 年前

    我解决了没有启用IPv6的问题 (在来自的帮助下 https://www.facebook.com/groups/k8skr )

    所以,原因是,违约 Kubernetes CNI Ubuntu的是0.6.0。 但问题是解决了 Kubernetes CNI 0.7.0 因此,您可以通过从下面的站点下载来更新它,并将bin文件替换为 /opt/cni/bin/

    https://github.com/containernetworking/plugins/releases/tag/v0.7.1

    至少,它对我有用:)

        3
  •  0
  •   Javeed Shakeel    6 年前

    我用这些链接修复了这个

    查看Kubernates故障排除指南和您使用的网络插件插件。

    https://kubernetes.io/docs/setup/independent/troubleshooting-kubeadm/#coredns-or-kube-dns-is-stuck-in-the-pending-state

    https://kubernetes.io/docs/concepts/cluster-administration/addons/

    安装以下部件并检查

    kubectl get pods -n kube-system
    
        4
  •  0
  •   Azeem Rob Hyndman    5 年前

    我必须启用到我的coredns pod的ipv6才能运行。

    以下是我遵循的步骤:

    https://www.thegeekdiary.com/how-to-enable-ipv6-on-centos-rhel-7/

    编辑 /etc/default/grub 改变内核参数的值 ipv6.disable 第1行到第0行:

    # grub2-mkconfig -o /boot/grub2/grub.cfg
    
    # shutdown -r now