DNS解析外部但不是kube集群的本地解析(密钥位于etcd中)

时间:2016-01-20 19:43:13

标签: kubernetes

DNS可以解析到群集外部的站点 对新容器,服务,节点等正确修改了etcd

这里有一些细节:

[fedora@kubemaster ~]$ kubectl logs kube-dns-v10-q9mlb -c kube2sky --namespace=kube-system
I0118 17:42:24.639508 1 kube2sky.go:436] Etcd server found: http://127.0.0.1:4001
I0118 17:42:25.642366 1 kube2sky.go:503] Using https://10.254.0.1:443 for kubernetes master
I0118 17:42:25.642772 1 kube2sky.go:504] Using kubernetes API 
[fedora@kubemaster ~]$

显示正确填充了etcd:

[fedora@kubemaster ~]$ kubectl exec -t busybox -- nslookup kubelab.local
Server: 10.254.0.10
Address 1: 10.254.0.10

nslookup: can't resolve 'kubelab.local'

error: error executing remote command: Error executing command in container: Error executing in Docker Container: 1

fedora@kubemaster ~]$ etcdctl ls --recursive
/kubelab.local
/kubelab.local/network
/kubelab.local/network/config
/kubelab.local/network/subnets
/kubelab.local/network/subnets/172.16.46.0-24
/kubelab.local/network/subnets/172.16.12.0-24
/kubelab.local/network/subnets/172.16.70.0-24
/kubelab.local/network/subnets/172.16.21.0-24
/kubelab.local/network/subnets/172.16.54.0-24
/kubelab.local/network/subnets/172.16.71.0-24

进一步帮助:

[fedora@kubemaster ~]$ kubectl exec --namespace=kube-system kube-dns-v10-6krfm -c skydns ps
PID   USER     COMMAND
    1 root     /skydns -machines=http://127.0.0.1:4001 -addr=0.0.0.0:53 -ns-rotate=false -domain=kubelab.local.
   11 root     ps
[fedora@kubemaster ~]$

我DID将cluster.local更改为kubelab.local,但我也在我的kubenode之前进行了更改:

KUBELET_ARGS="--kubeconfig=/etc/kubernetes/kubelet.kubeconfig --config=/etc/kubernetes/manifests --cluster-dns=10.254.0.10 --cluster-domain=kubelab.local"

/etc/resolv.conf在testhost上似乎没问题(在本例中,每个DNS文档示例为busybox):

[fedora@kubemaster ~]$ kubectl exec busybox -c busybox -i -t -- cat /etc/resolv.conf
search default.svc.kubelab.local svc.kubelab.local kubelab.local openstacklocal kubelab.com
nameserver 10.254.0.10
nameserver 192.168.1.70
options ndots:5
[fedora@kubemaster ~]$

结果=仍然有点令人沮丧:

[fedora@kubemaster ~]$ kubectl exec -t busybox -- nslookup kubelab.local
 Server:    10.254.0.10
 Address 1: 10.254.0.10

 nslookup: can't resolve 'kubelab.local'
 error: error executing remote command: Error executing command in container: Error executing in Docker Container: 1
[fedora@kubemaster ~]$

2 个答案:

答案 0 :(得分:0)

fedora@kubemaster ~]$ etcdctl ls --recursive /kubelab.local /kubelab.local/network /kubelab.local/network/config /kubelab.local/network/subnets /kubelab.local/network/subnets/172.16.46.0-24 /kubelab.local/network/subnets/172.16.12.0-24 /kubelab.local/network/subnets/172.16.70.0-24 /kubelab.local/network/subnets/172.16.21.0-24 /kubelab.local/network/subnets/172.16.54.0-24 /kubelab.local/network/subnets/172.16.71.0-24

这显示了法兰绒配置,而不是skydns。

答案 1 :(得分:0)

显示复制控制器信息,但是您是否也有服务设置?

apiVersion: v1
kind: Service
metadata:
  name: kube-dns
  namespace: kube-system
  labels:
    k8s-app: kube-dns
    kubernetes.io/cluster-service: "true"
    kubernetes.io/name: "KubeDNS"
spec:
  selector:
    k8s-app: kube-dns
  clusterIP: 10.3.0.10
  ports:
  - name: dns
    port: 53
    protocol: UDP
  - name: dns-tcp
    port: 53
    protocol: TCP