Interview Prep/Networking/Sockets, ports, TIME_WAIT and conntrack

You raised `nf_conntrack_max` on Kubernetes nodes via sysctl, but after a reboot or kube-proxy restart the value is back to something else.

IntermediateTroubleshootingSockets, ports, TIME_WAIT and conntrack
Answer

Likely causes → kube-proxy sets nf_conntrack_max itself on startup based on --conntrack-max-per-core × CPU cores (with --conntrack-min as a floor), overriding your sysctl. Also, if /etc/sysctl.d is applied before the nf_conntrack module loads, the key doesn't exist yet and is skipped.

Diagnose →

sysctl net.netfilter.nf_conntrack_max
kubectl -n kube-system get cm kube-proxy -o yaml | grep -A3 conntrack
journalctl -b | grep -i 'nf_conntrack'

Fix → Set it in kube-proxy's config (conntrack.maxPerCore, conntrack.min in KubeProxyConfiguration) and restart the DaemonSet. For non-kube-proxy hosts, load the module early (echo nf_conntrack > /etc/modules-load.d/conntrack.conf).

Prevent → Verify node sysctls after boot with a DaemonSet check or node-problem-detector, not just at provisioning time.

All Networking questions Roadmap: Networking for DevOps

More on Sockets, ports, TIME_WAIT and conntrack