kubernetes dns设置之后,pod中的container无法访问外网的问题


按照官方教程,安装好dns之后,创建的pod里面的container无法访问外网?是不是有解决方案
已邀请:

应该设置DNS Forwarding吧。

DNS Forwarding

By specifying nameservers in SkyDNS's config, for instance 8.8.8.8:53,8.8.4.4:53, you create a DNS forwarding proxy. In this case it round-robins between the two nameserver IPs mentioned.

Requests for which SkyDNS isn't authoritative will be forwarded and proxied back to the client. This means that you can set SkyDNS as the primary DNS server in /etc/resolv.conf and use it for both service discovery and normal DNS operations.

配置:
nameservers: forward DNS requests to these (recursive) nameservers (array of IP:port combination), when not authoritative for a domain. This defaults to the servers listed in /etc/resolv.conf. Also see no_rec.

环境变量:
SKYDNS_NAMESERVERS - set a list of nameservers to forward DNS requests to when not authoritative for a domain, "8.8.8.8:53,8.8.4.4:53". Overwrite with -nameservers string flag.

不好意思来挖坟了,请问这个问题解决了吗?我的也是PING 外部IP地址完全 没有问题,但是PING外部域名有时候不通

lethe3000

赞同来自:


我遇到类似问题,发现是dns的配置原因,实际是可以ping通外网ip的

wulonghui - PaaS工程师

赞同来自:


没有配置DNS,能访问访问么?

用心阁

赞同来自:


用docker inspect查看一下你的容器的DNS配置,我这里DNS服务器有两个,一个是集群内部的SkyDNS,一个是外面的DNS服务器,如8.8.8.8

要回复问题请先登录注册