社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
在centos7上部署的kubernetes环境,今天遇到一个很坑的问题,有的pod里面域名可以解析成功,有的pod无法解析,下面看下问题现象:同一个deploy下面的三个副本,有两个pod解析域名失败,有一个是成功的;
有的deploy下面的副本,索性直接域名解析失败,
问题分析:
[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 ~]#
[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作者提供的宝贵经验,谢谢!
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!