Insecure cluster exposure: Kubernetes API, dashboards, and kubelets
Kubernetes control-plane endpoints exposed to the internet are a direct route to the cluster. How to check API server access, anonymous auth, kubelet ports, and dashboards, and how to restrict them.
Diagram
Exposure checks for a cluster you run
Step 1 of 4
API server
Is the endpoint public, and from which networks?
$ aws eks describe-cluster --name prod --query "cluster.resourcesVpcConfig.{public:endpointPublicAccess,cidrs:publicAccessCidrs}"
{"public": true, "cidrs": ["0.0.0.0/0"]}The example on the open step is one illustration, or the fix you can paste into an application you own.
What this page is made of
3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.
Public API server
- What fails
- An API server open to the internet relies entirely on authentication.
- Who is affected
- The entire cluster.
- What you would notice
- Public endpoints with 0.0.0.0/0 allowed.
- What you change
- Use a private endpoint or a narrow allow-list.
Anonymous bindings
- What fails
- RBAC bindings to system:anonymous or system:unauthenticated grant access to anyone.
- Who is affected
- Resources those bindings cover.
- What you would notice
- ClusterRoleBindings naming those groups.
- What you change
- Remove them and disable anonymous auth where possible.
Dashboards and kubelets
- What fails
- Web dashboards and kubelet APIs bypass normal review.
- Who is affected
- Workloads and secrets.
- What you would notice
- Dashboard services of type LoadBalancer, or kubelet ports open in security groups.
- What you change
- Keep them private and require authentication.
Checking RBAC bindings
List bindings that include unauthenticated subjects.
$ kubectl get clusterrolebindings -o json | jq -r '.items[] | select(.subjects[]?.name | test("system:(anonymous|unauthenticated)")) | .metadata.name'
system:public-info-viewerCheck yourself
Recognition and the fix. Nothing here is a procedure.
Which binding is expected by default and only exposes version info?
Sibling techniques
Pages at the same depth, plus a lab and a glossary card for this one.
This page stands on its own. The lab and the glossary card are the next reading.