Skip to main content

More Info:

Disable the read-only port.

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. On every worker node, check how kubelet is configured (file vs flags):
    Inspect the command line: if you see --config=/var/lib/kubelet/config.yaml it is using the config file; if you see --read-only-port= it is using flags.
  2. If using the kubelet config file, edit it to disable the read-only port:
    If there is no readOnlyPort line, add it under the top-level kubeletConfiguration block, for example:
  3. If using command-line arguments, edit the kubelet systemd drop-in on each worker node:
    If --read-only-port is missing, add it to the KUBELET_SYSTEM_PODS_ARGS (or the line with other -- flags), for example:
  4. On every worker node, reload systemd and restart kubelet (this will restart the kubelet and may briefly impact pod scheduling/health reporting on that node):
  5. Verify on every worker node that kubelet is running with the read-only port disabled:
    Confirm either that:
    • the kubelet command line contains --read-only-port=0, or
    • kubelet is using /var/lib/kubelet/config.yaml and that file contains readOnlyPort: 0.
kubectl cannot modify kubelet process flags or its config file on worker nodes; this setting must be changed directly on each node’s /var/lib/kubelet/config.yaml or in the kubelet systemd unit. Refer to the Manual Steps section for the exact on-node configuration and restart instructions.

Additional Reading: