kubernetes(centos7)域名解析失败

5 篇文章 1 订阅
4 篇文章 0 订阅

安装在centos7上的kubernetes环境部分pod域名解析失败问题分析

问题描述:

在centos7上部署的kubernetes环境,今天遇到一个很坑的问题,有的pod里面域名可以解析成功,有的pod无法解析,下面看下问题现象:同一个deploy下面的三个副本,有两个pod解析域名失败,有一个是成功的;
在这里插入图片描述
有的deploy下面的副本,索性直接域名解析失败,
在这里插入图片描述
问题分析:

  • 1 首先按照这个链接:http://www.mydlq.club/article/78/,一步步的操作排查。
  • 2 上面我遇到的问题原因是cenos7内核降低导致的,
[root@centos-wt01 ~]# cat /boot/grub2/grub.cfg | grep menuentry
if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
  menuentry_id_option=""
export menuentry_id_option
menuentry 'CentOS Linux (4.4.248-1.el7.elrepo.x86_64) 7 (Core)'   ... ...
menuentry 'CentOS Linux (3.10.0-1062.el7.x86_64) 7 (Core)' ... ...
[root@centos-wt01 ~]#

我原来使用的是centos7的3.10.0-1062.el7.x86_64版本的内核,我升级centos7系统内核版本到4.4.248-1.el7.elrepo.x86_64解决问题。
升级操作步骤如下,

## 载入公钥
$ rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

## 安装 ELRepo 最新版本
$ yum install -y https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm

## 列出可以使用的 kernel 包版本
$ yum list available --disablerepo=* --enablerepo=elrepo-kernel

## 安装指定的 kernel 版本:
$ yum install -y kernel-lt-4.4.218-1.el7.elrepo --enablerepo=elrepo-kernel

## 查看系统可用内核
$ cat /boot/grub2/grub.cfg | grep menuentry

menuentry 'CentOS Linux (3.10.0-1062.el7.x86_64) 7 (Core)' --class centos (略)
menuentry 'CentOS Linux (4.4.218-1.el7.elrepo.x86_64) 7 (Core)' --class centos ...(略)

## 设置开机从新内核启动
$ grub2-set-default "CentOS Linux (4.4.218-1.el7.elrepo.x86_64) 7 (Core)"

## 查看内核启动项
$ grub2-editenv list
saved_entry=CentOS Linux (4.4.218-1.el7.elrepo.x86_64) 7 (Core)

重启系统使内核生效:

reboot

启动完成查看内核版本是否更新:

[root@centos-wt01 ~]# uname -r
4.4.248-1.el7.elrepo.x86_64
[root@centos-wt01 ~]#
  • 3 测试 Pod 中 DNS 是否能够正常解析
[root@centos-wt01 ~]# kubectl exec -it dnsutils /bin/sh
/ # ping www.baidu.com
PING www.baidu.com (180.101.49.11): 56 data bytes
64 bytes from 180.101.49.11: seq=0 ttl=127 time=5.983 ms
64 bytes from 180.101.49.11: seq=1 ttl=127 time=4.984 ms
^C
--- www.baidu.com ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 4.984/5.483/5.983 ms
/ #
/ # nslookup kubernetes.default
Server:         10.96.0.10
Address:        10.96.0.10#53

Name:   kubernetes.default.svc.cluster.local
Address: 10.96.0.1

可以看到 Pod 中的域名解析已经恢复正常。
最后,感谢http://www.mydlq.club/article/78作者提供的宝贵经验,谢谢!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值