Kubernetes API access security comes down to three checks on every request (who you are, what you may do, and whether the request content is acceptable), plus a network and credential setup that keeps strangers from reaching the API server at all. Get those layers right and the API is hard to abuse. Get one wrong, such as an overly generous role binding or an exposed endpoint, and the other layers may not save you. This guide walks through each layer, the mistakes that show up most often, and how to handle the admin credentials that sit on your own laptop.
TL;DR
- Every API request passes through authentication, authorization and admission control. Access is denied unless a module approves it.
- Audit bindings for
system:anonymousandsystem:unauthenticated, avoid wildcard RBAC rules, and keepsystem:mastersfor break-glass use only. - Limit who can reach the API server on the network, and never expose admission webhooks publicly.
- Treat kubeconfig files as secrets: they are the keys to the API. Store them locally, scope them narrowly and rotate them.
- Use
livezandreadyzfor health checks, not the deprecatedhealthz.
Table of Contents
- Why the API server is the real perimeter
- The three gates every request passes
- Network exposure: private is not the same as safe
- Audit for the backdoors attackers actually use
- Health checks: use the right endpoints
- The laptop layer: kubeconfigs are API keys
- Our perspective
- Making least privilege practical day to day
- Where Kubezilla Desktop fits
- A short checklist
- FAQ
- Sources
Why the API server is the real perimeter
Everything in a cluster goes through the API server. Humans use kubectl, controllers use client libraries, and CI systems make plain REST calls. Whoever can talk to that endpoint with enough rights can create, change or delete workloads. That makes the API server the single most valuable target in the cluster, and it is why a pod-level hardening effort alone never finishes the job.
The Kubernetes project describes a defense-in-depth model called the four C's: Cloud, Cluster, Container and Code. Each layer builds on the one beneath it, so strong application code cannot make up for a weak cluster configuration or an exposed cloud network. API access sits in the cluster layer, but it depends on the cloud layer (network rules, identity) and feeds the container layer (what can be deployed).
Complexity makes this harder. One 2025 analysis reports that 37% of organizations cite security concerns as a Kubernetes inhibitor and over a third struggle to manage multiple clusters. More clusters means more API endpoints, more kubeconfigs and more places for a permissive default to hide.
The three gates every request passes
The official access-control overview describes three stages. Knowing which one is failing tells you where to look.
| Stage | Question it answers | Typical mechanisms | Failure looks like |
|---|---|---|---|
| Authentication | Who is this? | Client certificates, OIDC tokens, service account tokens | 401 Unauthorized |
| Authorization | Is this identity allowed to do this? | RBAC, webhook authorizers | 403 Forbidden |
| Admission control | Is the request content acceptable? | Validating and mutating admission controllers | Request rejected or modified |
If no authorization module approves a request, the API server returns HTTP 403. That deny-by-default behavior is a strength, but only if you do not hand out broad approvals.
Authentication: know who is calling
For humans, prefer short-lived identity from your identity provider over long-lived client certificates. OIDC lets you revoke a person by disabling the account, while a client certificate embedded in a kubeconfig stays valid until it expires. For workloads, use service accounts with the narrowest possible rights, and avoid mounting tokens into pods that never call the API.
Then check anonymous access. According to the Kubernetes authentication documentation, anonymous requests are enabled by default when an authorization mode other than AlwaysAllow is used, and you can switch them off with --anonymous-auth=false on the API server. If you rely on anonymous access for something like a load balancer health probe, scope it tightly rather than leaving the door generally open. On managed services you usually cannot set that flag yourself, so check the provider's settings and audit the bindings instead.

Authorization: RBAC without surprises
Authorization happens after authentication, and for most teams that means RBAC. Three RBAC habits cause most of the trouble.
Wildcards. A rule that grants * on all resources looks convenient. The Kubernetes RBAC good-practices guide warns that wildcards also cover custom resources and any API objects added later, so a compromised credential's blast radius grows silently with every operator you install.
system:masters. Membership in this group bypasses RBAC and authorization webhooks entirely, and it cannot be revoked through RoleBindings. The same guide says to reserve it as a break-glass mechanism and not to use it for routine administration. If your day-to-day kubeconfig puts you in that group, that is the first thing to change.
nodes/proxy. This permission looks like a harmless read-only grant for monitoring tools. It is not. The OpenFaaS write-up on the nodes/proxy issue explains that it can reach the Kubelet API on port 10250, which can bypass cluster-level audit logging and admission policies. The write-up also notes that exploitation depends on specific conditions, such as a compromised service account token and network reach to the kubelet, so treat it as a reason to review grants and restrict kubelet access, not as a reason to panic. A public proof of concept shows why: the kubelet trusts that the API server already authorized the caller.

Admission control: the gate people forget to protect
Admission controllers validate and mutate requests after authorization. They are also network services in their own right. Research into the IngressNightmare vulnerabilities (CVE-2025-1974 and related issues) showed how an admission controller reachable across the network without authentication can become a path to remote code execution. The advice from researchers is to make sure admission webhooks are reachable only through internal cluster traffic, never directly from outside.
Admission is also where server-side checks actually happen. If you preview changes before applying them, remember that only a server-side dry run exercises admission, which we cover in our guide to Kubernetes dry runs.
Network exposure: private is not the same as safe
A cluster with a private endpoint feels safe, but that assumption can be wrong. A Google Cloud post about GKE authorized networks explains that clusters were reachable through internal cloud service pathways, and that restricting API access to specific, dedicated IP ranges is more reliable than depending on broad network-level exposure. The principle applies on any cloud: list the exact sources that may reach the API server, and review that list when you add services.
For private clusters you still need a way in. The two common answers are a VPN and a bastion host. Both work, and both add moving parts: another credential, another access policy, another thing to patch. An SSH tunnel to a single bastion is simpler, and we walk through it, including the certificate errors that trip people up, in our Kubernetes SSH tunnel guide.
Audit for the backdoors attackers actually use
An exposed or over-permissive API server is a favorite place to plant persistence. Aqua Security's research on RBAC-based backdoors describes how attackers who gain access can create rogue ClusterRoleBindings, including ones tied to system:anonymous, that survive credential rotation and are easy to miss. The recommended habit is to periodically review all bindings that mention system:anonymous and system:unauthenticated.
A starting routine you can run today:
- List every ClusterRoleBinding and RoleBinding and look for subjects like
system:anonymous,system:unauthenticatedor broad groups. - Search roles for wildcard verbs and resources.
- Find every identity in
system:masters, and remove any that are not true break-glass accounts. - Check who holds
nodes/proxy,secretsread access, and the ability to create pods or exec into them. - Confirm API audit logging is on and shipped somewhere an attacker with cluster rights cannot erase it.
Repeat on a schedule, and again after any incident or staff change.
Health checks: use the right endpoints
API security questions often drift into probe configuration, so here is the quick answer. The healthz endpoint has been deprecated since Kubernetes v1.16. Use livez to learn whether the server is alive and should be restarted, and readyz to learn whether it is ready to accept traffic. Scripts should rely on the HTTP status code (200 means healthy), and the verbose parameter is meant for humans debugging. If a probe needs anonymous access to these paths, grant exactly that and nothing wider.
The laptop layer: kubeconfigs are API keys
Most guides stop at the cluster. But the API is also reached from engineers' machines, and a kubeconfig holds the certificates, tokens or exec plugins that open it. Common failure patterns include:
- Merged kubeconfigs with dozens of contexts, where one mistaken
kubectl deletehits production. - Admin credentials from cluster setup that never got replaced with scoped ones.
- Config files synced into cloud drives, shared in chat, or committed to a repository.
- Tools that send usage data or sync cluster details to a vendor cloud.
Sensible rules: keep one scoped credential per person per cluster, prefer short-lived tokens, never sync config files to shared storage, and know which tools phone home. Our guide to kubeconfig context management covers switching, merging and staying safe. If you work across several clusters, multi-cluster management has the access-pattern side. For GitOps credentials, see how to skip static tokens in Argo CD.
Our perspective
We build Kubezilla Desktop, so we spend our days thinking about the point where an engineer meets the API server. Our view is that most access incidents are not exotic exploits. They are ordinary credentials sitting in ordinary places with more power than the job needed.
That is why we made the app local-first. Kubeconfigs are stored securely on your machine, there is no cloud sync and no telemetry, so your cluster details do not leave your device through us. It connects to multiple clusters directly or through SSH tunnels, which means you can reach a private cluster without standing up a VPN or an extra bastion just for your own access. We wrote it in Rust to keep it light, with low memory use and fast startup, because a tool you resent opening is a tool people replace with shortcuts.
We will also be plain about limits. A desktop client cannot fix a cluster with wildcard roles or an exposed webhook. What it can do is cut down the number of terminals, browser tabs and half-trusted helper scripts between you and the API, which is where careless habits breed. Fix the RBAC first, then make the safe path the easy path.
— Margus
Making least privilege practical day to day
Tight RBAC fails when it gets in the way, because people respond by borrowing an admin kubeconfig. Make the narrow path pleasant:
- Give each team a namespace-scoped role covering what they do weekly: view logs, exec into pods, scale deployments, restart rollouts. Our namespace management guide shows how to structure this.
- Keep a separate, audited break-glass identity for emergencies, and alert when it is used.
- Review role usage rather than guessing. Grants nobody exercises are candidates for removal.
- Prefer the same permission model everywhere, including multi-cloud setups, so people do not learn the weakest cluster's habits.
A useful test: could an engineer do a normal day's work, such as scaling a deployment, using only their scoped credential? If not, the role is wrong, and the temptation to bypass it is real.
Where Kubezilla Desktop fits
If you manage several clusters and want a native app that keeps kubeconfigs on your machine, Kubezilla Desktop gives you one interface for resources, live logs, metrics, pod terminals, YAML editing, workload scaling, Helm and Argo CD operations, and PVC file browsing. It runs on Linux, macOS and Windows and supports SSH tunneling to private clusters. It costs €5 per month, and you can see the details on the pricing page.
It works with the permissions you already have, so it complements a sound RBAC design instead of replacing one.
A short checklist
- Disable or tightly scope anonymous access, and audit
system:anonymousandsystem:unauthenticatedbindings. - Use OIDC or other short-lived identity for people.
- Remove wildcard rules and review
nodes/proxy. - Keep
system:mastersfor break-glass only. - Restrict API server reachability to named sources, and keep admission webhooks internal.
- Turn on audit logging and ship it off the cluster.
- Store kubeconfigs locally, scope them, rotate them, and avoid tools that sync or report them.
FAQ
How do I protect the Kubernetes API from unauthorized access?
Layer your controls. Require authentication for every caller, authorize with narrowly scoped RBAC, and use admission control to validate requests. Then restrict network reach to known sources and audit bindings regularly, especially anything tied to anonymous users.
What are the four C's of Kubernetes security?
They are Cloud, Cluster, Container and Code. Each layer depends on the one below it, so hardening code does not help if the cluster or cloud configuration is weak. API access is mostly a cluster-layer concern with cloud-layer network dependencies.
Is healthz deprecated?
Yes. The API server's healthz endpoint has been deprecated since Kubernetes v1.16. Use livez to check that the server is alive and readyz to check that it can accept traffic, and rely on the HTTP status code in automation.
Is a private cluster endpoint enough?
No. Private endpoints reduce exposure, but internal cloud pathways and other services in the network can still reach them. Limit access to specific, named IP ranges and combine that with strong authentication and RBAC.
Sources
- Controlling Access to the Kubernetes API
- Authenticating | Kubernetes
- Authorization | Kubernetes
- Role Based Access Control Good Practices | Kubernetes
- Kubernetes API health endpoints
- Cloud Native Security Overview | Kubernetes
- How should OpenFaaS users approach nodes/proxy RCE in Kubernetes?
- Magier/Oopserability
- Leveraging Kubernetes RBAC to backdoor clusters | Aqua Security
- Critical ingress-nginx controller flaws | The Hacker News
- Updates coming for Authorized Networks on GKE | Google Cloud Blog
- Cloud Native Hits 15.6M Devs as Kubernetes Drops to 30% | byteiota
