Skip to main content

More Info:

The kubelet —read-only-port argument should be set to 0 to disable the unauthenticated read-only port. This port exposes node and pod information without authentication.

Risk Level

High

Address

Security

Compliance Standards

  • CIS OKE

Triage and Remediation

Remediation

Manual Steps

  1. On every worker node, open the kubelet systemd drop-in config for editing:
  2. In the ExecStart= line, ensure the kubelet is started with the read-only port disabled. Add --read-only-port=0 if it is missing, or change its value if present. For example:
  3. If the kubelet config file /etc/kubernetes/kubelet-config.json contains a readOnlyPort field, set it to 0 (or remove the field so the flag value is authoritative). For example:
    Ensure it looks like:
  4. Reload systemd and restart kubelet on the worker node:
  5. Confirm kubelet is running correctly:
  6. Verify on the same worker node that the kubelet process includes --read-only-port=0:
    Check the output and ensure --read-only-port=0 is present and there is no conflicting --read-only-port with a nonzero value.
kubectl cannot modify kubelet process flags or the host-level config file /etc/kubernetes/kubelet-config.json on worker nodes. To set --read-only-port=0, you must update the kubelet’s systemd configuration under /etc/systemd/system/kubelet.service.d/00-default.conf on every worker node and then restart kubelet; see the Manual Steps section for exact commands.
Usage:
  • Copy this script to every worker node (for example /root/fix-kubelet-readonly-port.sh).
  • Run as root on every worker node: