Search code examples
kubernetesnetworkinglinux-kerneltegraipvs

How to load ip_vs module successfully?


I write the following content to /etc/modules-load.d/ipvs.conf

ip_vs
ip_vs_rr
ip_vs_wrr
ip_vs_sh
nf_conntrack_ipv4

Then I execute sudo systemctl restart systemd-modules-load.service. However, its error shows,

Job for systemd-modules-load.service failed because the control process exited with error code.

Then I run sudo systemctl status systemd-modules-load.service, the error message shows that

...
Failed to find module 'ip_vs_wrr'
Failed to find module 'ip_vs_sh'
...

Then I use modprobe ip_vs_wrr, it returns the error message,

modprobe: FATAL: Module ip_vs_wrr not found in directory /lib/modules/4.9.201-tegra

I suppose that my system doesn't have ip_vs_wrr and ip_vs_sh module. My kernel version is Linux version 4.9.253-tegra and the system is Ubuntu 18.04.5 LTS. How can I load the ip_vs_wrr and ip_vs_sh module correctly? If I don't load these modules, can I still use kubernets successfully?


Solution

  • I'll answer to the last question which is directly related to kubernetes:

    If I don't load these modules, can I still use kubernets successfully?

    The answer is yes, you can use kubernetes.

    There are 3 different modes of kube-proxy which can be used in kubernetes cluster:

    • userspace (legacy, not recommended anymore)
    • iptables (default)
    • ipvs

    By default iptables is used. Using ipvs is reasonable if there are more than 1000 services within the cluster. For better understanding and comparison, you can read this article.

    If ipvs kernel modules are not available, cluster will start in iptables mode. This is from official documentation:

    Note: To run kube-proxy in IPVS mode, you must make IPVS available on the node before starting kube-proxy.

    When kube-proxy starts in IPVS proxy mode, it verifies whether IPVS kernel modules are available. If the IPVS kernel modules are not detected, then kube-proxy falls back to running in iptables proxy mode.