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.

Lesson 15 of 29 · 10 min read · practice only with authorization

Diagram

Exposure checks for a cluster you run

Follow the path. One example at a time.

Step 1 of 4

API server

Is the endpoint public, and from which networks?

Illustration: API server
$ 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.

  1. 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.
  2. 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.
  3. 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-viewer

Check yourself

Recognition and the fix. Nothing here is a procedure.

1 / 3

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.

Practice

  1. LabTerminal mission: Redis on a public load balancerAn external scan found port 6379 open on a cluster IP. Match it to a Service, check which namespaces have a default-deny network policy, and name the gap.

Glossary

  1. CardInsecure cluster exposureKubernetes APIs, dashboards, or node ports are reachable from the internet without strong identity.