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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章