简体   繁体   English

Kubernetes V1.11.0 HA群集CoreDNS PODS未出现

[英]Kubernetes V1.11.0 HA cluster CoreDNS PODS not coming up

I am trying to create Kubernetes V1.11.0 HA cluster in Centos 7 server. 我正在尝试在Centos 7服务器中创建Kubernetes V1.11.0 HA集群。 I have IPV6 disabled on my host. 我在主机上禁用了IPV6。

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

Based on these steps added all three master, coreDNS POD is not coming up, its keep logging below error in /var/log/messages file. 根据这些步骤,添加了所有三个主服务器,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

error message: 错误信息:

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

How to fix this error message and bring the coreDNS PODs? 如何解决此错误消息并带来coreDNS POD?

Thanks 谢谢

There is an issue on Coreos Github that describes exactly your case. Coreos Github上有一个问题可以准确描述您的情况。 And the suggestion to solve the issue was: 解决该问题的建议是:

squeed : You are using an old version of CNI, which does not work on systems with ipv6 disabled. squeed :您使用的是旧版本的CNI,该版本在禁用ipv6的系统上不起作用。 Please re-enable ipv6 or upgrade CNI. 请重新启用ipv6或升级CNI。

And regarding the related issue on CNI Github he also mentioned: 关于CNI Github的相关问题,他还提到:

squeed : As I already explained, this has been fixed for 6 months. squeed :正如我已经解释的,此问题已修复6个月。 Please upgrade your CNI plugins. 请升级您的CNI插件。

And jellonek commented: 耶隆内克评论说:

This is the question for your deployment software provider, which in your case is probably https://github.com/kubernetes/kubeadm 这是您的部署软件提供商的问题,在您的情况下可能是https://github.com/kubernetes/kubeadm

However, in cases when you need to turn off ipv6 for some reason, you can install a cluster with addon KubeDNS instead of CoreDNS using kubeadm : 但是,如果出于某些原因需要关闭ipv6,则可以使用kubeadm使用插件 KubeDNS而不是CoreDNS安装集群:

kubeadm init --pod-network-cidr=192.168.0.0/16 --feature-gates=CoreDNS=false kubeadm初始化--pod-network-cidr = 192.168.0.0 / 16 --feature-gates = CoreDNS = false

Or you can delete CoreDNS deployment and service, and then apply KubeDNS yaml, which should be generated or adjusted to your actual cluster configuration. 或者,您可以删除CoreDNS部署和服务,然后应用KubeDNS yaml,应将其生成或调整为实际的群集配置。

Here is a function from the deployAddons.sh file responsible for deploying kube-dns addon: 这是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
}

I have to enable the IPv6 to my CoreDNS pod to run. 我必须为我的CoreDNS pod启用IPv6才能运行。

Here is the steps I followed: 这是我遵循的步骤:

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

Edit /etc/default/grub and change the value of kernel parameter ipv6.disable from 1 to 0 in line: 编辑/etc/default/grub并将以下行的内核参数ipv6.disable的值从1更改为0:

# grub2-mkconfig -o /boot/grub2/grub.cfg

# shutdown -r now

I solved the problem without IPv6 enabling (with help from https://www.facebook.com/groups/k8skr ) 我在没有启用IPv6的情况下解决了问题(在https://www.facebook.com/groups/k8skr的帮助下)

So, the reason is that, default Kubernetes CNI of Ubuntu is 0.6.0. 因此,原因是,Ubuntu的默认Kubernetes CNI为0.6.0。 But the problem is fixed with Kubernetes CNI 0.7.0 So you can update it through download from the below site and replace bin files to /opt/cni/bin/ 但是问题已通过Kubernetes CNI 0.7.0修复,因此您可以通过从以下站点下载进行更新并将bin文件替换为/opt/cni/bin/

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

At least, it works for me :) 至少,它对我有用:)

I fixed this with the reference of these links 我通过这些链接的参考解决了这个问题

check with kubernates troubleshooting guide and the networking plugin addons you have used 检查kubernates故障排除指南和您使用过的网络插件插件

https://kubernetes.io/docs/setup/independent/troubleshooting-kubeadm/#coredns-or-kube-dns-is-stuck-in-the-pending-state 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/ https://kubernetes.io/docs/concepts/cluster-administration/addons/

And install the following with those and check 并安装以下内容并检查

kubectl get pods -n kube-system

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM