gpt4 book ai didi

kubernetes - Kubernetes 中的 skydns 服务无法解析 'kubernetes'

转载 作者:行者123 更新时间:2023-12-05 01:18:22 29 4
gpt4 key购买 nike

core@core-1-94 ~ $ kubectl exec -it busybox -- nslookup kubernetesServer:    10.100.0.10Address 1: 10.100.0.10nslookup: can't resolve 'kubernetes'core@core-1-94 ~ $ kubectl get svc --namespace=kube-systemNAME       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/TCPkube-ui    k8s-app=kube-ui,kubernetes.io/cluster-service=true,kubernetes.io/name=KubeUI     k8s-app=kube-ui    10.100.110.236   80/TCPcore@core-1-94 ~ $ kubectl exec -it busybox -- nslookup kubernetes 10.100.0.10:53Server:    10.100.0.10Address 1: 10.100.0.10nslookup: can't resolve 'kubernetes'core@core-1-94 ~ $ kubectl get endpoints --namespace=kube-systemNAME       ENDPOINTSkube-dns   10.244.31.16:53,10.244.31.16:53kube-ui    10.244.3.2:8080core@core-1-94 ~ $ kubectl exec -it busybox -- nslookup kubernetes 10.244.31.16:53Server:    10.244.31.16Address 1: 10.244.31.16Name:      kubernetesAddress 1: 10.100.0.1

我认为kube-dns的服务不可用。

skydns-svc.yaml:

apiVersion: v1kind: Servicemetadata:  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

谁能帮忙?

最佳答案

为了使 DNS 正常工作,kubelet 需要在启动时传递 --cluster_dns= 和 --cluster_domain=cluster.local 标志。此标志不包含在 the set of flags passed to the kubelet 中,因此 kubelet 不会尝试联系您为名称解析服务创建的 DNS pod。要解决此问题,您可以修改脚本以将这两个标志添加到 kubelet,然后在创建 DNS 服务时,需要确保将传递给 --cluster_dns 标志的 IP 地址设置为 PortalIP服务规范字段,如 this 。其他信息,您可以查看it .

关于kubernetes - Kubernetes 中的 skydns 服务无法解析 'kubernetes',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32754264/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com