CertGrid CertGrid
Hands-on Lab·Certified Kubernetes Security Specialist

Restricting Kubernetes API Access

Restricting API access means three different things - who may call without a credential, what they get if they do, and who can reach the endpoint at all. This guide measures all three on a live cluster and closes the third with one policy.

Cluster Hardening Guide 12 of 40 Advanced

--anonymous-auth is not set on this apiserver, so it defaults to true. Authorization mode is Node,RBAC, which is what turns an anonymous request into a 403 rather than a 200.

The cka6001 cluster: one control plane and 2 schedulable workers, on Cilium.
Server NameIP AddressOSRolesCPURAMHDD
CKA6001192.168.0.46Ubuntu 26.04 LTSControl Plane Node (tainted NoSchedule)2 Core4 GB50 GB
CKA6001-NODE01192.168.0.47Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB
CKA6001-NODE02192.168.0.48Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB

This guide includes

Use this when API access has to be restricted, which turns out to mean three separate things. This matters because anonymous access defaults to on, and every Pod in the cluster can reach the control plane unless something stops it.

Before you start

  1. What the apiserver answers with no credential at all

  2. The flags and the bindings that decide it

  3. Every Pod can reach the control plane

Official sources