环境信息:
k8s:1.19
linux内核 大版本:centos 4.18
故障现象:
通过kubectl或其他工具访问apiserver,明显卡顿;报 timeout等异常,严重影响k8s管理
问题定位:
通过排查定位到某一apiserver节点访问出现问题,超时甚至无响应
问题排查:
通过登录到有问题的apiserver节点主机,查看message日志,发现如下日志:
Mar 27 05:14:35 10-xxx-xxx-143 kernel: watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [swapper/1:0]
Mar 27 05:14:35 10-xxx-xxx-143 kernel: Modules linked in: xt_CT xt_multiport iptable_raw ip_set_hash_ip ip_set_hash_net veth xt_set ip_set_hash_ipportnet ip_set_hash_ipportip ip_set_bitmap_port ip_set_hash_ipport ip_set dummy nf_tables ip6table_nat nf_conntrack_ipv6 nf_nat_ipv6 ip6_tables iptable_mangle xt_comment xt_mark udp_diag unix_diag xt_conntrack ipt_MASQUERADE nf_conntrack_netlink nfnetlink xt_addrtype iptable_filter iptable_nat nf_nat_ipv4 nf_nat br_netfilter bridge stp llc overlay tcp_diag inet_diag nfit libnvdimm crct10dif_pclmul crc32_pclmul ghash_clmulni_intel intel_rapl_perf virtio_balloon i2c_piix4 joydev pcspkr sunrpc ip_vs_sh ip_vs_wrr ip_vs_rr ip_vs nf_conntrack_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrack libcrc32c ip_tables ext4 mbcache jbd2 ata_generic serio_raw crc32c_intel virtio_net cirrus net_failover
Mar 27 05:14:35 10-xxx-xxx-143 kernel: virtio_console failover drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm virtio_blk ata_piix libata
Mar 27 05:14:35 10-xxx-xxx-143 kernel: CPU: 1 PID: 0 Comm: swapper/1 Kdump: loaded Not tainted 4.18.0-80.1.1.el7.ksyun.x86_64 #1
Mar 27 05:14:35 10-xxx-xxx-143 kernel: Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
Mar 27 05:14:35 10-xxx-xxx-143 kernel: RIP: 0010:ipt_do_table+0x159/0x650 [ip_tables]
通过分析,发现"BUG: soft lockup - CPU#0 stuck for 22s",cpu发生软锁现象;
原因分析:
大量iptable调用引起的内核锁定过长,造成cpu soft lockup ,也即内核软锁死
问题解决:
临时解决:
因为是生产集群,保存必要的现场数据后,重启恢复;
长期解决:
进一步分析和查阅相关资料,发现该内核版本有类似cve提出:

所以我们提出:
1、 升级内核到5以上版本
高版本内核
https://linux.cc.iitk.ac.in/mirror/centos/elrepo/kernel/el7/x86_64/RPMS/
2、 关闭iptables(不推荐)
3、迁移到新ubuntu等其他系统
最终,我们选择3,目前正常恢复
参考链接:link

479

被折叠的 条评论
为什么被折叠?



