无法 nslookup kubernetes.default
Not able to nslookup kubernetes.default
我在 Ubuntu 16.04
上安装了 kubernetes 集群 运行ning。当我 运行 nslookup kubernetes.default
在 master
上显示如下:
Server: 192.168.88.21
Address: 192.168.88.21#53
** server can't find kubernetes.default: NXDOMAIN
以下是/etc/resolv.conf
的内容
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.88.21
nameserver 127.0.1.1
search VISDWK.local
使用kubernetes版本
kubeadm version: &version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T10:36:44Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
使用 weave 进行联网并安装使用:
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
coredns
pods都运行宁晴:
coredns-86c58d9df4-42xqc 1/1 Running 8 1d6h
coredns-86c58d9df4-p6d98 1/1 Running 7 1d1h
下面是coredns-86c58d9df4-42xqc
的日志
.:53
2019-02-08T08:40:10.038Z [INFO] CoreDNS-1.2.6
2019-02-08T08:40:10.039Z [INFO] linux/amd64, go1.11.2, 756749c
CoreDNS-1.2.6
linux/amd64, go1.11.2, 756749c
[INFO] plugin/reload: Running configuration MD5 = f65c4821c8a9b7b5eb30fa4fbc167769
t
任何人都可以帮我调试这个问题。请帮忙。谢谢。
busybox 图片有问题。它有效,但在 nslookup 命令为 运行
后出现一些错误
[node1 ~]$ kubectl run busybox1 --image busybox --restart=Never --rm -it -- sh
If you don't see a command prompt, try pressing enter.
/ # nslookup kubernetes
Server: 10.96.0.10
Address: 10.96.0.10:53
Name: kubernetes.default.svc.cluster.local
Address: 10.96.0.1
*** Can't find kubernetes.svc.cluster.local: No answer
*** Can't find kubernetes.cluster.local: No answer
*** Can't find kubernetes.default.svc.cluster.local: No answer
*** Can't find kubernetes.svc.cluster.local: No answer
*** Can't find kubernetes.cluster.local: No answer
/ # exit
pod "busybox1" deleted
[node1 ~]$
尝试下图。它工作得很好。其他版本抛出一些错误
busybox:1.28
[node1 ~]$ kubectl run busybox1 --image busybox:1.28 --restart=Never --rm -it -- sh
If you don't see a command prompt, try pressing enter.
/ # nslookup kubernetes
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: kubernetes
Address 1: 10.96.0.1 kubernetes.default.svc.cluster.local
/ # exit
pod "busybox1" deleted
从主
测试api服务器
[node1 ~]$ kubectl get svc|grep kubernetes
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 2h
[node1 ~]$
[node1 ~]$ curl -k https://10.96.0.1/version
{
"major": "1",
"minor": "11",
"gitVersion": "v1.11.7",
"gitCommit": "65ecaf0671341311ce6aea0edab46ee69f65d59e",
"gitTreeState": "clean",
"buildDate": "2019-01-24T19:22:45Z",
"goVersion": "go1.10.7",
"compiler": "gc",
"platform": "linux/amd64"
}[node1 ~]$
我在 Ubuntu 16.04
上安装了 kubernetes 集群 运行ning。当我 运行 nslookup kubernetes.default
在 master
上显示如下:
Server: 192.168.88.21
Address: 192.168.88.21#53
** server can't find kubernetes.default: NXDOMAIN
以下是/etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.88.21
nameserver 127.0.1.1
search VISDWK.local
使用kubernetes版本
kubeadm version: &version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T10:36:44Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
使用 weave 进行联网并安装使用:
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
coredns
pods都运行宁晴:
coredns-86c58d9df4-42xqc 1/1 Running 8 1d6h
coredns-86c58d9df4-p6d98 1/1 Running 7 1d1h
下面是coredns-86c58d9df4-42xqc
.:53
2019-02-08T08:40:10.038Z [INFO] CoreDNS-1.2.6
2019-02-08T08:40:10.039Z [INFO] linux/amd64, go1.11.2, 756749c
CoreDNS-1.2.6
linux/amd64, go1.11.2, 756749c
[INFO] plugin/reload: Running configuration MD5 = f65c4821c8a9b7b5eb30fa4fbc167769
t
任何人都可以帮我调试这个问题。请帮忙。谢谢。
busybox 图片有问题。它有效,但在 nslookup 命令为 运行
后出现一些错误[node1 ~]$ kubectl run busybox1 --image busybox --restart=Never --rm -it -- sh
If you don't see a command prompt, try pressing enter.
/ # nslookup kubernetes
Server: 10.96.0.10
Address: 10.96.0.10:53
Name: kubernetes.default.svc.cluster.local
Address: 10.96.0.1
*** Can't find kubernetes.svc.cluster.local: No answer
*** Can't find kubernetes.cluster.local: No answer
*** Can't find kubernetes.default.svc.cluster.local: No answer
*** Can't find kubernetes.svc.cluster.local: No answer
*** Can't find kubernetes.cluster.local: No answer
/ # exit
pod "busybox1" deleted
[node1 ~]$
尝试下图。它工作得很好。其他版本抛出一些错误
busybox:1.28
[node1 ~]$ kubectl run busybox1 --image busybox:1.28 --restart=Never --rm -it -- sh
If you don't see a command prompt, try pressing enter.
/ # nslookup kubernetes
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: kubernetes
Address 1: 10.96.0.1 kubernetes.default.svc.cluster.local
/ # exit
pod "busybox1" deleted
从主
测试api服务器[node1 ~]$ kubectl get svc|grep kubernetes
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 2h
[node1 ~]$
[node1 ~]$ curl -k https://10.96.0.1/version
{
"major": "1",
"minor": "11",
"gitVersion": "v1.11.7",
"gitCommit": "65ecaf0671341311ce6aea0edab46ee69f65d59e",
"gitTreeState": "clean",
"buildDate": "2019-01-24T19:22:45Z",
"goVersion": "go1.10.7",
"compiler": "gc",
"platform": "linux/amd64"
}[node1 ~]$