kube-proxy: Failed to load kernel module ip_vs with modprobe.

偶遇 kube-proxy ipvs 模式不能正常工作,报错如下:

W0301 09:14:39.492670       1 proxier.go:498] Failed to load kernel module ip_vs with modprobe. You can ignore this message when kube-proxy is running inside container without mounting /lib/modules
W0301 09:14:39.493401       1 proxier.go:498] Failed to load kernel module ip_vs_rr with modprobe. You can ignore this message when kube-proxy is running inside container without mounting /lib/modules
W0301 09:14:39.494103       1 proxier.go:498] Failed to load kernel module ip_vs_wrr with modprobe. You can ignore this message when kube-proxy is running inside container without mounting /lib/modules
W0301 09:14:39.494841       1 proxier.go:498] Failed to load kernel module ip_vs_sh with modprobe. You can ignore this message when kube-proxy is running inside container without mounting /lib/modules
W0301 09:14:39.500439       1 proxier.go:498] Failed to load kernel module ip_vs with modprobe. You can ignore this message when kube-proxy is running inside container without mounting /lib/modules
W0301 09:14:39.501168       1 proxier.go:498] Failed to load kernel module ip_vs_rr with modprobe. You can ignore this message when kube-proxy is running inside container without mounting /lib/modules
W0301 09:14:39.501883       1 proxier.go:498] Failed to load kernel module ip_vs_wrr with modprobe. You can ignore this message when kube-proxy is running inside container without mounting /lib/modules
W0301 09:14:39.502612       1 proxier.go:498] Failed to load kernel module ip_vs_sh with modprobe. You can ignore this message when kube-proxy is running inside container without mounting /lib/modules

这是由于 kube-proxy 容器没能自动挂载宿主机内核模块导致的。

可以手动在宿主机执行命令,挂载需要的内核模块:

[root@machine ~]# modprobe ip_vs
[root@machine ~]# modprobe ip_vs_rr
[root@machine ~]# modprobe ip_vs_wrr
[root@machine ~]# modprobe ip_vs_sh

然后,重启 kube-proxy,发现已经没有原来的警告,且工作在 ipvs 代理模式了

I0301 09:19:09.567473       1 server_others.go:176] Using ipvs Proxier.
W0301 09:19:09.567860       1 proxier.go:380] clusterCIDR not specified, unable to distinguish between internal and external traffic
W0301 09:19:09.567872       1 proxier.go:386] IPVS scheduler not specified, use rr by default
I0301 09:19:09.568520       1 server.go:562] Version: v1.14.2
I0301 09:19:09.580637       1 conntrack.go:52] Setting nf_conntrack_max to 131072
I0301 09:19:09.582465       1 config.go:102] Starting endpoints config controller
I0301 09:19:09.582487       1 controller_utils.go:1027] Waiting for caches to sync for endpoints config controller
I0301 09:19:09.582549       1 config.go:202] Starting service config controller
I0301 09:19:09.582557       1 controller_utils.go:1027] Waiting for caches to sync for service config controller
I0301 09:19:09.682604       1 controller_utils.go:1034] Caches are synced for service config controller
I0301 09:19:09.682604       1 controller_utils.go:1034] Caches are synced for endpoints config controller
发布了272 篇原创文章 · 获赞 93 · 访问量 39万+

猜你喜欢

转载自blog.csdn.net/shida_csdn/article/details/104596539