我正在 GKE 上设置 kubernetes,如 Kelsey Hightowers https://github.com/kelseyhightower/kubernetes-the-hard-way/中所述
一切正常,除了设置 DNS ClusterAddon https://github.com/kelseyhightower/kubernetes-the-hard-way/blob/master/docs/12-dns-addon.md
当我像这样启动 kube-dns 时:
kubectl create -f https://storage.googleapis.com/kubernetes-the-hard-way/kube-dns.yaml
我确实得到了预期的输出:
serviceaccount "kube-dns" created
configmap "kube-dns" created
service "kube-dns"
created deployment "kube-dns" created
但是检查 pod 的状态和 kube-dns 容器的输出我看到了错误:
kubectl get po -n kube-system
NAME READY STATUS RESTARTS AGE
kube-dns-6c857864fb-cpvvr 2/3 CrashLoopBackOff 63 2h
并在容器日志中:
I0115 13:22:35.272492 1 dns.go:173] Waiting for services and endpoints to be initialized from apiserver...
I0115 13:22:35.772476 1 dns.go:173] Waiting for services and endpoints to be initialized from apiserver...
I0115 13:22:36.272406 1 dns.go:173] Waiting for services and endpoints to be initialized from apiserver...
I0115 13:22:36.772356 1 dns.go:173] Waiting for services and endpoints to be initialized from apiserver...
I0115 13:22:37.272386 1 dns.go:173] Waiting for services and endpoints to be initialized from apiserver...
E0115 13:22:37.273178 1 reflector.go:201] k8s.io/dns/pkg/dns/dns.go:147: Failed to list *v1.Endpoints: Get https://10.32.0.1:443/api/v1/endpoints?resourceVersion=0: dial tcp 10.32.0.1:443: i/o timeout
E0115 13:22:37.273340 1 reflector.go:201] k8s.io/dns/pkg/dns/dns.go:150: Failed to list *v1.Service: Get https://10.32.0.1:443/api/v1/services?resourceVersion=0: dial tcp 10.32.0.1:443: i/o timeout
容器日志中的 URL https://10.32.0.1:443似乎是错误的,但是我找不到可以指定不同 URL 的任何地方,也找不到在配置文件https://中设置此 URL 的位置storage.googleapis.com/kubernetes-the-hard-way/kube-dns.yaml