CoreDNS仅在kubernete集群中的一台主机中工作 [英] CoreDNS only works in one host in kubernete cluster

查看:357
本文介绍了CoreDNS仅在kubernete集群中的一台主机中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有3个节点的kubernetes:

[root@ops001 ~]# kubectl get nodes
NAME            STATUS   ROLES    AGE    VERSION
azshara-k8s01   Ready    <none>   143d   v1.15.2
azshara-k8s02   Ready    <none>   143d   v1.15.2
azshara-k8s03   Ready    <none>   143d   v1.15.2

当我部署了一些Pod之后,我发现只有一个节点azshara-k8s03可以解析DNS,其他两个节点无法解析DNS.这是我的azshara-k8s03主机节点/etc/resolv.conf:

options timeout:2 attempts:3 rotate single-request-reopen
; generated by /usr/sbin/dhclient-script
nameserver 100.100.2.136
nameserver 100.100.2.138

这是另外2个节点/etc/resolv.conf:

nameserver 114.114.114.114

我应该保持不变吗?如何使DNS在3个节点上正常工作?

解决方案

您是否尝试过从节点实际访问114.114.114.114?如果不是,请将其更改为实际上是;-]

还要检查您的Kublet实际使用的是哪个resolv.conf:通常不是/etc/resolv.conf的其他事情:执行ps ax |grep kubelet并检查--resolv-conf标志的值,并查看该文件中的DNS是否正常工作.

更新:

在两个有问题的节点上,哪些名称无法解析?这些是公共名称还是仅内部名称?如果它们仅是内部的,则114.114.114不会知道它们.我无法访问100.100.2.136100.100.2.138:它们是您的内部DNS吗?如果是这样,请尝试仅在两个无效的节点上将/etc/resolv.conf更改为与有效的节点上的相同.

I have a kubernetes with 3 nodes:

[root@ops001 ~]# kubectl get nodes
NAME            STATUS   ROLES    AGE    VERSION
azshara-k8s01   Ready    <none>   143d   v1.15.2
azshara-k8s02   Ready    <none>   143d   v1.15.2
azshara-k8s03   Ready    <none>   143d   v1.15.2

when after I am deployed some pods I found only one nodes azshara-k8s03 could resolve DNS, the other two nodes could not resolve DNS.this is my azshara-k8s03 host node /etc/resolv.conf:

options timeout:2 attempts:3 rotate single-request-reopen
; generated by /usr/sbin/dhclient-script
nameserver 100.100.2.136
nameserver 100.100.2.138

this is the other 2 node /etc/resolv.conf:

nameserver 114.114.114.114

should I keep the same ? what should I do to make the DNS works fine in 3 nodes?

解决方案

did you try if 114.114.114.114 is actually reachable from your nodes? if not, change it to something that actually is ;-]

also check which resolv.conf your kublets actually use: it is often something else than /etc/resolv.conf: do ps ax |grep kubelet and check the value of --resolv-conf flag and see if the DNSes in that file work correctly.

update:

what names are failing to resolve on the 2 problematic nodes? are these public names or internal only? if they are internal only than 114.114.114 will not know about them. 100.100.2.136 and 100.100.2.138 are not reachable for me: are they your internal DNSes? if so try to just change /etc/resolv.conf on 2 nodes that don't work to be the same as on the one that works.

这篇关于CoreDNS仅在kubernete集群中的一台主机中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆