CNTR-K8-000460 - Kubernetes DynamicKubeletConfig must not be enabled - manifest

Information

Kubernetes allows a user to configure kubelets with dynamic configurations. When dynamic configuration is used, the kubelet will watch for changes to the configuration file. When changes are made, the kubelet will automatically restart. Allowing this capability bypasses access restrictions and authorizations. Using this capability, an attacker can lower the security posture of the kubelet, which includes allowing the ability to run arbitrary commands in any container running on that node.

Solution

This fix is only applicable to Kubernetes version 1.25 and older.

On the Control Plane, change to the manifests' directory at /etc/kubernetes/manifests and run the command:
grep -i feature-gates *

Edit the manifest files so that every manifest has a '--feature-gates' setting with 'DynamicKubeletConfig=false'.

On each Control Plane and Worker Node, run the command:
ps -ef | grep kubelet

Remove the 'feature-gates' option if present.

Note the path to the config file (identified by --config).

Edit the config file:
Add a 'featureGates' setting if one does not yet exist. Add the feature gate 'DynamicKubeletConfig=false'.

Restart the kubelet service using the following command:
systemctl daemon-reload && systemctl restart kubelet

See Also

https://dl.dod.cyber.mil/wp-content/uploads/stigs/zip/U_Kubernetes_V1R11_STIG.zip

Item Details

Category: ACCESS CONTROL

References: 800-53|AC-3, CAT|II, CCI|CCI-000213, Rule-ID|SV-242399r918164_rule, STIG-ID|CNTR-K8-000460, Vuln-ID|V-242399

Plugin: Unix

Control ID: 70ee4af2ce7b18dbe7e21f9b3671013a7eff8e00ba349628e8be4c9ff219a785