Skip to main content

More Info:

Verifies that the controller-manager.conf kubeconfig file is owned by root:root so only privileged users can read its client credentials.

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. On every control plane node, confirm the file exists and view its current ownership:
  2. On every control plane node, set the ownership of the kubeconfig file to root:root:
  3. (Optional, but recommended) On every control plane node, restrict the permissions so only root can read/write:
  4. On every control plane node, verify the ownership is now root:root:
kubectl cannot modify host-level file ownership for /etc/kubernetes/controller-manager.conf on control plane nodes. This must be fixed directly on each control plane node’s filesystem; see the Manual Steps section for the exact commands to run over SSH.
Usage:
  • Copy this script to a file, for example /usr/local/sbin/fix-controller-manager-kubeconfig-ownership.sh.
  • Make it executable:
  • Run on every control plane node (as root):