我用两台电脑作为kubernetes的节点机。当我想通过kubectl查询日志时,出现如下错误,“no such host:
kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
coredns-775d49b59c-2vv4t 1/1 Running 1 21h
coredns-775d49b59c-4zltp 1/1 Running 0 21h
kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
istio Ready <none> 21h v1.20.3-rc.0.3+ccb394fd1a695f 192.168.56.201 <none> Ubuntu 18.04.5 LTS 5.4.0-58-generic docker://19.3.13
ms Ready <none> 22h v1.20.3-rc.0.3+ccb394fd1a695f 192.168.56.66 <none> Ubuntu 18.04.5 LTS 5.4.0-59-generic docker://19.3.13
kubectl logs coredns-775d49b59c-2vv4t -n kube-system
Error from server: Get "https://istio:10250/containerLogs/kube-system/coredns-775d49b59c-2vv4t/coredns": dial tcp: lookup istio on 127.0.0.11:53: no such host
thomas@ms:~$ ping istio
PING istio (192.168.56.201) 56(84) bytes of data.
64 bytes from istio (192.168.56.201): icmp_seq=1 ttl=64 time=2.30 ms
64 bytes from istio (192.168.56.201): icmp_seq=2 ttl=64 time=2.49 ms
thomas@istio:~$ ping istio
PING istio (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.060 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.052 ms
我的 cni 配置是:
{
"cniVersion": "0.3.1",
"name": "istionet",
"type": "bridge",
"bridge": "cnioistio",
"isGateway": true,
"ipMasq": true,
"ipam": {
"type": "host-local",
"subnet": "10.32.0.0/16",
"routes": [
{"dst": "0.0.0.0/0"}
]
}
}
我在 istio pc 中使用了 dig 命令到 istio:
dig @127.0.0.53 istio
ANSWER SECTION:
istio. 0 IN A 127.0.0.1
istio. 0 IN A 192.168.56.201
Query time: 0 msec
SERVER: 127.0.0.53#53(127.0.0.53)
WHEN: Thu Jan 28 15:47:19 CST 2021
MSG SIZE rcvd: 66
但是在我使用 127.0.0.11 之后,它显示连接超时;无法访问任何服务器。我可以ping 127.0.0.11 是docker DNS 问题吗?