问题
之前k8s网络运行正常,一段时间后,
前端pod无法通过域名访问后端pod,ping提示错误:Temporary failure in name resolution
如果看思路请顺序阅读
如果看结论,请跳过排查过程
排查排查过程
# kubectl get po -n kube-system|grep coredns
coredns-85dc89d45b-b9gtq 1/1 Running 0 52m
coredns-85dc89d45b-wkc6x 1/1 Running 0 52m
- 查看coredns日志是否正常,如果有错误日志一般都会打印
发现解析pod的域名时,被转发到8.8.8.8或114.114.114.114
那么问题就找到了
因为要解析k8s集群的服务或者pod域名,必须要到Coredns的kubernetes插件,而现在明显没有被转发到此插件,看配置
data:
Corefile: |
.:53 {
errors
health {
lameduck 5s
}
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
upstream /etc/resolv.conf
fallthrough in-a