diff --git a/cmd/kubeadm/app/preflight/checks.go b/cmd/kubeadm/app/preflight/checks.go index 9ac2c135d8e..ab02e96d264 100644 --- a/cmd/kubeadm/app/preflight/checks.go +++ b/cmd/kubeadm/app/preflight/checks.go @@ -1084,7 +1084,7 @@ func addCommonChecks(execer utilsexec.Interface, k8sVersion string, nodeReg *kub // non-windows checks checks = addSwapCheck(checks) - checks = addExecChecks(checks, execer) + checks = addExecChecks(checks, execer, k8sVersion) checks = append(checks, SystemVerificationCheck{}, HostnameCheck{nodeName: nodeReg.Name}, diff --git a/cmd/kubeadm/app/preflight/checks_linux.go b/cmd/kubeadm/app/preflight/checks_linux.go index 07b770050f2..97578a46140 100644 --- a/cmd/kubeadm/app/preflight/checks_linux.go +++ b/cmd/kubeadm/app/preflight/checks_linux.go @@ -24,6 +24,7 @@ import ( "github.com/pkg/errors" + utilversion "k8s.io/apimachinery/pkg/util/version" system "k8s.io/system-validators/validators" utilsexec "k8s.io/utils/exec" ) @@ -72,9 +73,16 @@ func addSwapCheck(checks []Checker) []Checker { } // addExecChecks adds checks that verify if certain binaries are in PATH -func addExecChecks(checks []Checker, execer utilsexec.Interface) []Checker { +func addExecChecks(checks []Checker, execer utilsexec.Interface, k8sVersion string) []Checker { + // For k8s >= 1.32.0, kube-proxy no longer depends on conntrack to be present in PATH + // (ref: https://github.com/kubernetes/kubernetes/pull/126952) + if v, err := utilversion.ParseSemantic(k8sVersion); err == nil { + if v.LessThan(utilversion.MustParseSemantic("1.32.0")) { + checks = append(checks, InPathCheck{executable: "conntrack", mandatory: true, exec: execer}) + } + } + checks = append(checks, - InPathCheck{executable: "conntrack", mandatory: true, exec: execer}, InPathCheck{executable: "ip", mandatory: true, exec: execer}, InPathCheck{executable: "iptables", mandatory: true, exec: execer}, InPathCheck{executable: "mount", mandatory: true, exec: execer}, diff --git a/cmd/kubeadm/app/preflight/checks_other.go b/cmd/kubeadm/app/preflight/checks_other.go index 62c6d9ba9dc..171d4bf80a6 100644 --- a/cmd/kubeadm/app/preflight/checks_other.go +++ b/cmd/kubeadm/app/preflight/checks_other.go @@ -50,6 +50,6 @@ func addSwapCheck(checks []Checker) []Checker { // addExecChecks adds checks that verify if certain binaries are in PATH // No-op for Darwin (MacOS), Windows. -func addExecChecks(checks []Checker, _ utilsexec.Interface) []Checker { +func addExecChecks(checks []Checker, _ utilsexec.Interface, _ string) []Checker { return checks }