How to configure sysctl parameters with Calico CNI

I have RKE2 cluster (version: v1.23.9 rke2r1) with installed Calico (version: v3.23.1).
I need to configure POD sysctl parameters - “net.ipv4.tcp_keepalive_time”, “net.ipv4.tcp_keepalive_intvl”, “net.ipv4.tcp_keepalive_probes”.

Calico manual says, that Calico CNI plugin (Container Network Interface plugin) is configured through standard CNI configuration mechanism:

Sysctl parameters can be configured with CNI tuning plugin:
https://www.cni.dev/plugins/current/meta/tuning/

Calico manual says, CNI plugin can be configured in Calico manifests:

I made changes in CNI plugin configuration file “/etc/cni/net.d/10-calico.conflist” on each cluster node and ConfigMap “cni-config” under namespace “calico-system”.
I added following sysctl CNI tuning plugin line, but after restarting daemonset, “10-calico.conflist” configuration file and ConfigMap are overwritten with default configuration:
{“type”: “tuning”, “sysctl”: {“net.ipv4.tcp_keepalive_time”: “300”, “net.ipv4.tcp_keepalive_intvl”: “45”, “net.ipv4.tcp_keepalive_probes”: “3”}}

Do you have any ideas, how to configure CNI plugins with Calico to be able to configure sysctl parameters for pods?
Thank You very much.

1 Like