Skip to main content

More Info:

Binding the kube-proxy metrics service to localhost prevents the metrics endpoint from being reachable across the network. This limits exposure of operational data to the local node only.

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. Identify how kube-proxy is started (systemd vs. manifest)
    • Run on: every worker node
    • From the output, note whether kube-proxy is started via:
      • a systemd unit referencing a config file (e.g. /etc/kubernetes/proxy.conf), or
      • a static pod manifest (e.g. /etc/kubernetes/manifests/kube-proxy.yaml).
    • The remaining steps assume the config file /etc/kubernetes/proxy.conf is in use; if not, adjust to the actual kube-proxy config file or manifest used on that node.
  2. Edit the kube-proxy configuration to bind metrics to localhost
    • Run on: every worker node
    • Open the config file:
    • In the metricsBindAddress field under kubeProxyConfiguration, set it to localhost if it is set to another address, or add it if missing:
    • Remove any non-localhost setting such as 0.0.0.0:10249 or a specific node IP.
  3. If kube-proxy is launched via command-line flags, ensure flags do not override localhost binding
    • Run on: every worker node
    • Check the kube-proxy process command for a --metrics-bind-address flag:
    • If you see a flag binding to a non-localhost address (for example --metrics-bind-address=0.0.0.0:10249), edit the systemd unit or launch script shown in the command line (for example /etc/systemd/system/kube-proxy.service), and either:
      • change it to:
        or
      • remove the flag entirely so the default 127.0.0.1:10249 from the config file applies.
    • After editing a systemd unit file, reload systemd:
  4. Restart kube-proxy to apply changes
    • Run on: every worker node
    • If kube-proxy is managed by systemd:
    • If kube-proxy runs as a static pod from a manifest, saving the edited manifest or config file usually causes the kubelet to automatically restart the pod. No extra command is needed, but be aware that editing a manifest used by kubelet will restart kube-proxy on that node.
  5. Verify that metrics are now bound to localhost
    • Run on: every worker node
    • Confirm in the command line or implied configuration that:
      • --metrics-bind-address is either absent or set to 127.0.0.1:10249, and
      • there is no binding of the metrics service to a non-localhost address.
kubectl cannot modify kube-proxy’s host-level configuration or the /etc/kubernetes/proxy.conf file where the metrics binding is set; this must be fixed directly on every worker node. See the Manual Steps section for how to edit the configuration and restart kube-proxy safely.