kubernetes(centos7)域名解析失败 - Go语言中文社区

kubernetes(centos7)域名解析失败


安装在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作者提供的宝贵经验,谢谢!

版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/qq_34533957/article/details/111409196
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢