centos nslookup

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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值