Skip to main content

More Info:

The kubelet read-only port exposes cluster data without authentication and should be disabled by setting readOnlyPort to 0.

Risk Level

High

Address

Security

Compliance Standards

  • CIS AKS

Triage and Remediation

Remediation

Manual Steps

  1. On every worker node, check how kubelet is started:
    Inspect the output to see whether --config=/var/lib/kubelet/config.yaml is used and whether a --read-only-port flag is present.
  2. If using the kubelet config file /var/lib/kubelet/config.yaml (common with kubeadm), edit it on every worker node and set readOnlyPort to 0:
    If readOnlyPort is not present, add it under the top-level fields (align indentation with other keys):
  3. If kubelet is using a systemd unit flag instead of (or in addition to) the config file, edit /etc/systemd/system/kubelet.service.d/10-kubeadm.conf on every worker node and ensure --read-only-port=0 is set in the kubelet arguments (either in KUBELET_SYSTEM_PODS_ARGS or the relevant KUBELET_* variable):
    If no --read-only-port is present, append it to the kubelet options line, for example:
  4. Reload systemd and restart kubelet on every worker node (this will temporarily disrupt workloads on that node while kubelet restarts):
  5. Verify on every worker node that kubelet no longer exposes a nonzero read-only port:
    Confirm that:
    • There is no --read-only-port flag with a value other than 0, and
    • If present as a flag, it is --read-only-port=0.
      If relying solely on the config file, you may additionally confirm the setting:
kubectl cannot change the kubelet’s readOnlyPort setting because it is controlled by host-level configuration on each worker node (/var/lib/kubelet/config.yaml and/or the systemd unit kubelet.service). To remediate this finding, make the changes directly on every worker node as described in the Manual Steps section.