pod dns在k8s中未解析

时间:2018-04-23 13:01:54

标签: dns kubernetes load-balancing kubernetes-pod

我有2个名为A和B的服务

我有服务A的pod a1,a2,a3。

我有服务B的pod b1,b2,b3。

服务A - > Type = ClusterIP

服务B - > Type = LoadBalancer

如果我尝试从a1执行nslookup - > b1我收到以下错误。

std::vector

请帮助我找到问题以及为什么无法从其他广告连播中找到该问题

用实际信息更新::

  >kubectl exec a1 -- nslookup b1

  nslookup: can't resolve '(null)': Name does not resolve
  nslookup: can't resolve 'cassandra-0': Name does not resolve
  command terminated with exit code 1

1 个答案:

答案 0 :(得分:1)

它的工作原理如docs所述。这是一个简单的例子:

# in one terminal: 
$ kubectl run -i -t --rm there --restart=Never --image=quay.io/mhausenblas/jump:0.2 -- sh

# in another terminal
$ kubectl describe pod there | grep IP
IP:           172.17.0.7
$ kubectl run -i -t --rm here --restart=Never --image=quay.io/mhausenblas/jump:0.2 -- sh
~ $ nslookup 172-17-0-7.default.pod
nslookup: can't resolve '(null)': Name does not resolve

Name:      172-17-0-7.default.pod
Address 1: 172.17.0.7