centos nslookup
1. yum install bind-utils2.[root@k8s-master ~]# kubectl get svcNAMETYPECLUSTER-IPEXTERNAL-IPPORT(S)AGEkubernetesClusterIP10.1.0.1...
1. yum install bind-utils
2.
[root@k8s-master ~]# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.1.0.1 <none> 443/TCP 7d1h
kubernetes-bootcamp NodePort 10.1.120.140 <none> 8080:30991/TCP 151m
[root@k8s-master ~]# nslookup kubernetes-bootcamp
;; connection timed out; no servers could be reached
[root@k8s-master ~]# nslookup kubernetes-bootcamp.default.svc
Server: 192.168.159.2
Address: 192.168.159.2#53
** server can't find kubernetes-bootcamp.default.svc: NXDOMAIN
[root@k8s-master ~]#
3.
[root@k8s-master ~]# kubectl get svc -owide -nkube-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
kube-dns ClusterIP 10.1.0.10 <none> 53/UDP,53/TCP,9153/TCP 7d1h k8s-app=kube-dns
[root@k8s-master ~]# vim /etc/resolv.conf
1 # Generated by NetworkManager
2 # search localdomain
3 nameserver 10.1.0.10
4 nameserver 192.168.159.2
5 nameserver 10.244.0.6
6 nameserver 10.244.0.7
7 search localdomain default.svc.cluster.local svc.cluster.local cluster.local
(注: kube-dns的cluster-ip作为第一个nameserver,否则可能会解析出错)
4.
[root@k8s-master ~]# nslookup kubernetes-bootcamp.default.svc
Server: 10.1.0.10
Address: 10.1.0.10#53
** server can't find kubernetes-bootcamp.default.svc: NXDOMAIN
[root@k8s-master ~]# nslookup kubernetes-bootcamp.default.svc.cluster.local
Server: 10.1.0.10
Address: 10.1.0.10#53
Name: kubernetes-bootcamp.default.svc.cluster.local
Address: 10.1.120.140
[root@k8s-master ~]# kubectl get svc -owide
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
kubernetes ClusterIP 10.1.0.1 <none> 443/TCP 7d1h <none>
kubernetes-bootcamp NodePort 10.1.120.140 <none> 8080:30991/TCP 167m run=kubernetes-bootcamp
[root@k8s-master ~]#
更多推荐
所有评论(0)