Exposed Kubernetes API servers are among the fastest routes from an internet scan to full cluster takeover, and many teams never confirm whether theirs is reachable from outside. If you run Kubernetes on EKS, GKE, AKS or on bare metal, this article explains how an exposed control plane becomes a takeover, which ports attackers check first, and how to verify and lock down your own endpoints this week. The aim is simple: know exactly what an outsider sees when they reach your cluster, before someone else finds out.
Why the API Server Is the Crown Jewel
The kube-apiserver is the front door to everything in the cluster. Every kubectl command, controller and CI job talks to it, usually on TCP 6443, sometimes on 443 behind a load balancer. Anyone who can call it with enough privileges can create pods, read secrets, mount host filesystems and pivot into the underlying cloud account.
Takeover rarely needs a zero-day. It needs one of three things: anonymous access with overly generous RBAC, a leaked token or kubeconfig, or a neighbouring component such as the kubelet or etcd left open. Port scanning finds all three at the reconnaissance stage. Shodan and Censys index Kubernetes endpoints by their TLS certificates, which typically list names like kubernetes.default.svc, so finding them takes no effort.
The scale is not theoretical. In 2022, Shadowserver reported more than 380,000 Kubernetes API servers that answered external requests in some form. Most rejected anything sensitive, but every one of them showed up as a target in someone’s scan.
How an Exposed Kubernetes API Server Leads to Cluster Takeover
A typical attack chain is short. An attacker sweeps for 6443, 10250, 10255 and 2379, then runs service detection to confirm what answers. A request to /version returns the exact Kubernetes build, and on many clusters it works without credentials because the default system:public-info-viewer role allows it. That version string goes straight into a CVE lookup. CVE-2018-1002105, for example, allowed privilege escalation through the API server and was fixed in 1.10.11, 1.11.5 and 1.12.3. Old clusters still turn up running versions from before those fixes.
Next comes a privilege check. If someone once bound system:anonymous or system:unauthenticated to cluster-admin “just to test something”, a plain curl to /api/v1/namespaces/kube-system/secrets returns service account tokens. From there the attacker launches a privileged pod with hostPath mounted to /, escapes to the node and pulls cloud credentials from the instance metadata service. Cryptominer deployment usually comes first. It is noisy, and it is often how the breach gets noticed.
The kubelet is the quieter path. Port 10250 with –anonymous-auth=true and authorization mode AlwaysAllow lets an outsider exec into any container on that node, with no API server involved. Read-only port 10255 leaks pod specs, environment variables and image names. TeamTNT campaigns in 2020-2021 harvested credentials from exactly these kinds of exposed kubelets and Docker APIs. In the 2018 Tesla incident, attackers used an unauthenticated Kubernetes dashboard to mine cryptocurrency and reach AWS credentials. The broader pattern is covered in how threat actors weaponize exposed management interfaces.
The Managed Kubernetes Myth
A common belief is that managed Kubernetes is private by default, so exposure is the cloud provider’s problem. It isn’t. Amazon EKS creates a public API endpoint by default, open to 0.0.0.0/0, unless you set publicAccessCidrs or turn off public access. GKE Standard clusters also get a public control plane endpoint unless authorized networks or a private cluster are configured. AKS gives you authorized IP ranges and private clusters, but you have to enable them.
The provider patches the control plane. You decide who can reach it. Authentication helps, but it does not remove the risk: a public endpoint is exposed to every leaked kubeconfig on a developer laptop, every CI token committed to a public GitHub repo, and every future API server CVE before you upgrade.
Verifying Your Exposure Step by Step
An experienced platform engineer tests from outside the network first, because internal checks show what the firewall should do, not what it actually does. A practical sequence:
1. External port scan. From a host outside your VPC, run nmap -sV -p 443,2379,2380,6443,10250,10255 against every public IP and load balancer address tied to the cluster. Include NAT gateways and node IPs, not just the API endpoint.
2. Anonymous probe. Run curl -k https://IP:6443/version and then curl -k https://IP:6443/api/v1/pods. A 401 or 403 on the second call is what you want. A JSON pod list means you have an incident to handle.
3. RBAC audit. Inside the cluster, run kubectl auth can-i –list –as=system:anonymous and look for ClusterRoleBindings that reference system:unauthenticated.
4. Kubelet check. Confirm that every node’s kubelet config sets authentication.anonymous.enabled: false and authorization.mode: Webhook, and that readOnlyPort is 0.
5. Endpoint restriction. Limit the API endpoint to VPN egress IPs, CI runner ranges and bastion addresses. For most teams that’s 3-10 CIDRs, not the whole internet.
The full scan and probe take about 15 minutes per cluster. For deeper control plane and node hardening, see Kubernetes port security for protecting your cluster.
Common Mistakes That Keep Clusters Exposed
The first mistake is fixing the API server and forgetting the nodes. Teams lock 6443 behind authorized networks, but the worker nodes keep public IPs and a security group that allows 10250 from anywhere, often added during a debugging session months earlier. The kubelet then gives an attacker the same result the API server would have.
The second is NodePort sprawl. Services of type NodePort open ports in the 30000-32767 range on every node. A Grafana, Argo CD or Kubernetes Dashboard published that way ends up on the internet without anyone deciding it should. Argo CD with an admin session is effectively cluster-admin.
The third is a single scan at cluster creation. Clusters change all the time: node pools autoscale with new IPs, Helm charts add LoadBalancer services, and someone changes a CIDR to 0.0.0.0/0 during an outage and never reverts it. An exposure that appears on a Friday evening can be indexed by Shodan before Monday. Ongoing external monitoring catches that drift. A scan run once at launch does not.
Edge Cases Worth Knowing
Air-gapped and on-prem clusters are not automatically safe. Flat corporate networks, site-to-site VPNs to vendors and jump hosts often give far more people reach to 6443 than anyone intended. In regulated environments under PCI DSS or DORA, a reachable control plane is usually an audit finding even when authentication is strong.
The reverse case matters too. Some teams need a public endpoint, for example GitOps from SaaS CI runners whose IP ranges are not published. Then compensate: OIDC authentication with short-lived tokens, no static service account tokens, audit logging sent to a SIEM, and alerts on any request from system:anonymous.
If you find something actively exploited, isolate before investigating. Cordon the affected nodes, rotate service account tokens and cloud credentials, and snapshot the disks. Containment steps after finding a rogue listener walks through that order in detail.
FAQ
Is port 6443 being reachable from the internet automatically a vulnerability?
Not on its own, but it puts the cluster one stolen credential or one unpatched CVE away from takeover. Restrict it to known source ranges unless there is a documented business reason not to.
Does the insecure port 8080 still matter?
The insecure API server port was removed in Kubernetes 1.20. It can still appear on legacy self-managed clusters, though, and anything answering unauthenticated on 8080 with a Kubernetes API response should be treated as critical.
How often should Kubernetes endpoints be scanned externally?
At least daily for production clusters, and after every infrastructure change. Autoscaling and Helm deployments change the external footprint far more often than monthly reviews can track.
Summary
Taking over a cluster through an exposed Kubernetes API server rarely takes advanced skill. It takes a reachable port, a permissive binding or leaked token, and enough time. Scan from outside, probe anonymously, audit RBAC, and lock down the kubelet as firmly as the API server. Then keep checking, because the cluster you hardened last quarter is not the cluster running today.
