You are configuring kubelet to protect kernel defaults. Which flag enables this?
Trap 1: --security-opt=protect-kernel
The flag --security-opt=protect-kernel is a Docker daemon/container runtime flag used to add security labels to containers, not a kubelet flag. The kubelet does not parse --security-opt at all; kernel hardening for the node is controlled by the dedicated kubelet flag --protect-kernel-defaults. Attempting to pass this Docker-specific option to kubelet will result in an 'unknown flag' error and prevent the kubelet from starting.
Trap 2: --enable-protect-kernel
--enable-protect-kernel is not a recognized kubelet flag; the kubelet's CLI and configuration schema only define a boolean flag named --protect-kernel-defaults. Kubelet flags do not use an 'enable' prefix for this feature, so supplying this variant would cause a fatal 'unknown flag' error during startup. The correct way to enable the protection is to set --protect-kernel-defaults=true (or via the protectKernelDefaults field in the kubelet configuration file).
Trap 3: --kernel-security
--kernel-security is a hypothetical flag that does not exist in the kubelet's flag list. Kubelet security is implemented via discrete options such as --protect-kernel-defaults, --read-only-port, and --anonymous-auth, but there is no catch-all 'kernel-security' switch. This option might be confused with SELinux or AppArmor profiles, which are configured at the container runtime level, not through a single kubelet flag.
- A
--security-opt=protect-kernel
Why it fails: The flag --security-opt=protect-kernel is a Docker daemon/container runtime flag used to add security labels to containers, not a kubelet flag. The kubelet does not parse --security-opt at all; kernel hardening for the node is controlled by the dedicated kubelet flag --protect-kernel-defaults. Attempting to pass this Docker-specific option to kubelet will result in an 'unknown flag' error and prevent the kubelet from starting.
- B
--protect-kernel-defaults
The kubelet flag --protect-kernel-defaults, when set to true, enforces that the node's kernel parameters (such as vm.overcommit_memory and kernel.panic) are at their default secure values, and it refuses to start if these settings deviate. This flag also blocks pods from overriding unsafe sysctls, preventing kernel-level misconfigurations that could compromise the node. It is the only correct flag among the options for enabling this kind of kernel protection in a Kubernetes kubelet.
- C
--enable-protect-kernel
Why it fails: --enable-protect-kernel is not a recognized kubelet flag; the kubelet's CLI and configuration schema only define a boolean flag named --protect-kernel-defaults. Kubelet flags do not use an 'enable' prefix for this feature, so supplying this variant would cause a fatal 'unknown flag' error during startup. The correct way to enable the protection is to set --protect-kernel-defaults=true (or via the protectKernelDefaults field in the kubelet configuration file).
- D
--kernel-security
Why it fails: --kernel-security is a hypothetical flag that does not exist in the kubelet's flag list. Kubelet security is implemented via discrete options such as --protect-kernel-defaults, --read-only-port, and --anonymous-auth, but there is no catch-all 'kernel-security' switch. This option might be confused with SELinux or AppArmor profiles, which are configured at the container runtime level, not through a single kubelet flag.