问题:
dns不通
[root@k8s-master ~]# kubectl exec -it busyBoxx sh/ # nslookup NginxServer: 10.254.230.254Address 1: 10.254.230.254nslookup: can't resolve 'Nginx'/ # cat /etc/resolv.conf search default.svc.cluster.local svc.cluster.local cluster.localnameserver 10.254.230.254nameserver 8.8.8.8options ndots:5
查看pod日志
[root@k8s-master ~]# kubectl logs -f kube-dns-3204099596-x7vdj -c kubedns -n kube-systemI0613 20:15:12.651122 1 dns.go:42] version: v1.6.0-Alpha.0.680+3872cb93abf948-dirtyI0613 20:15:12.651262 1 server.go:107] Using http://192.168.150.61:8080 for kubernetes master, kubernetes API: v1I0613 20:15:12.651550 1 server.go:68] Using configuration read from ConfigMap: kube-system:kube-dnsI0613 20:15:12.651599 1 server.go:113] FLAG: --alsologtostderr="false"I0613 20:15:12.651613 1 server.go:113] FLAG: --config-map="kube-dns"I0613 20:15:12.651620 1 server.go:113] FLAG: --config-map-namespace="kube-system"I0613 20:15:12.651626 1 server.go:113] FLAG: --dns-bind-address="0.0.0.0"I0613 20:15:12.651630 1 server.go:113] FLAG: --dns-port="10053"I0613 20:15:12.651637 1 server.go:113] FLAG: --domain="cluster.local."I0613 20:15:12.651645 1 server.go:113] FLAG: --federations=""I0613 20:15:12.651651 1 server.go:113] FLAG: --healthz-port="8081"I0613 20:15:12.651656 1 server.go:113] FLAG: --kube-master-url="http://192.168.150.61:8080"I0613 20:15:12.651662 1 server.go:113] FLAG: --kubecfg-file=""I0613 20:15:12.651666 1 server.go:113] FLAG: --log-backtrace-at=":0"I0613 20:15:12.651673 1 server.go:113] FLAG: --log-dir=""I0613 20:15:12.651679 1 server.go:113] FLAG: --log-flush-frequency="5s"I0613 20:15:12.651685 1 server.go:113] FLAG: --logtostderr="true"I0613 20:15:12.651691 1 server.go:113] FLAG: --stderrthreshold="2"I0613 20:15:12.651695 1 server.go:113] FLAG: --v="0"I0613 20:15:12.651700 1 server.go:113] FLAG: --version="false"I0613 20:15:12.651707 1 server.go:113] FLAG: --vmodule=""I0613 20:15:12.651756 1 server.go:155] Starting SkyDNS server (0.0.0.0:10053)I0613 20:15:12.666762 1 server.go:165] Skydns metrics enabled (/metrics:10055)I0613 20:15:12.669465 1 logs.go:41] skydns: ready for querIEs on cluster.local. for tcp://0.0.0.0:10053 [rcache 0]I0613 20:15:12.669518 1 logs.go:41] skydns: ready for querIEs on cluster.local. for udp://0.0.0.0:10053 [rcache 0]E0613 20:15:12.679738 1 sync.go:105] Error getting ConfigMap kube-system:kube-dns err: configmaps "kube-dns" not foundE0613 20:15:12.679763 1 dns.go:190] Error getting initial ConfigMap: configmaps "kube-dns" not found, starting with default valuesI0613 20:15:12.684971 1 server.go:126] Setting up Healthz Handler (/readiness)I0613 20:15:12.685000 1 server.go:131] Setting up cache handler (/cache)I0613 20:15:12.685007 1 server.go:120] Status http port 8081
解决:
[root@k8s-master ~]# cat kube-dns-cm.yml APIVersion: v1kind: ConfigMapMetadata: name: kube-dns namespace: kube-systemdata: upstreamnameservers: | ["1.2.3.4"]
kubectl create -f kube-dns-cm.yml
重启kube.
[root@k8s-master ~]# kubectl get deploy,po,svc,cm,ep -n kube-systemname DESIRED CURRENT UP-TO-DATE AVAILABLE AGEdeploy/kube-dns 1 1 1 1 33mname READY STATUS RESTARTS AGEpo/kube-dns-3204099596-n2w84 4/4 UnkNown 0 33mpo/kube-dns-3204099596-x7vdj 4/4 Running 0 23mname CLUSTER-IP EXTERNAL-IP PORT(S) AGEsvc/kube-dns 10.254.230.254 <none> 53/UDP,53/TCP 31mname DATA AGEcm/kube-dns 1 13mname ENDPOINTS AGEep/kube-controller-manager <none> 25mep/kube-dns 10.0.55.7:53,10.0.55.7:53 31mep/kube-scheduler <none> 25m
再次 nslookup
[root@k8s-master ~]# kubectl exec -it busyBoxx sh/ # nslookup kubernetesServer: 10.254.230.254Address 1: 10.254.230.254 kube-dns.kube-system.svc.cluster.localname: kubernetesAddress 1: 10.254.0.1 kubernetes.default.svc.cluster.local/ # nslookup NginxServer: 10.254.230.254Address 1: 10.254.230.254 kube-dns.kube-system.svc.cluster.localname: NginxAddress 1: 10.254.213.70 Nginx.default.svc.cluster.local
参考
https://cloud.tencent.com/developer/article/1649590
https://www.thinBUG.com/q/43240135
以上是内存溢出为你收集整理的Error getting ConfigMap kube-system:kube-dns err: configmaps “kube-dns“ not found全部内容,希望文章能够帮你解决Error getting ConfigMap kube-system:kube-dns err: configmaps “kube-dns“ not found所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)