core@core-1-94 ~ $ kubectl exec -it busybox -- nslookup kubernetes Server: 10.100.0.10 Address 1: 10.100.0.10 nslookup: can't resolve 'kubernetes' core@core-1-94 ~ $ kubectl get svc --namespace=kube-system NAME LABELS SELECTOR IP(S) PORT(S) kube-dns k8s-app=kube-dns,kubernetes.io/cluster-service=true,kubernetes.io/name=KubeDNS k8s-app=kube-dns 10.100.0.10 53/UDP 53/TCP kube-ui k8s-app=kube-ui,kubernetes.io/cluster-service=true,kubernetes.io/name=KubeUI k8s-app=kube-ui 10.100.110.236 80/TCP core@core-1-94 ~ $ kubectl exec -it busybox -- nslookup kubernetes 10.100.0.10:53 Server: 10.100.0.10 Address 1: 10.100.0.10 nslookup: can't resolve 'kubernetes' core@core-1-94 ~ $ kubectl get endpoints --namespace=kube-system NAME ENDPOINTS kube-dns 10.244.31.16:53,10.244.31.16:53 kube-ui 10.244.3.2:8080 core@core-1-94 ~ $ kubectl exec -it busybox -- nslookup kubernetes 10.244.31.16:53 Server: 10.244.31.16 Address 1: 10.244.31.16 Name: kubernetes Address 1: 10.100.0.1
我认为kube-dns
的服务不可用。
skydns-svc.yaml
:
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.100.0.10 ports: - name: dns port: 53 protocol: UDP - name: dns-tcp port: 53 protocol: TCP
谁可以提供帮助?
答案 0 :(得分:4)
要使DNS正常工作,需要在启动时传递kubelet标志--cluster_dns =和--cluster_domain = cluster.local。此标记未包含在the set of flags passed to the kubelet中,因此kubelet不会尝试联系您为名称解析服务创建的DNS窗格。要解决此问题,您可以修改脚本以将这两个标志添加到kubelet,然后在创建DNS服务时,您需要确保将传递给--cluster_dns标志的相同IP地址设置为portalIP服务规范的字段,如this。 对于任何其他信息,您可以查看it。