Kubernetes Admission Controllers: The API's Gatekeepers

Think of admission controllers as bouncers for your Kubernetes API. They intercept requests before objects are saved, enforcing custom policies like security rules or required labels. The footgun: a broken controller can block all changes to your cluster.
Why it exists
Kubernetes needs a way to enforce custom policies, security standards, and configuration best practices before an object is created or updated. Without this, you could only react to bad configurations after they're already running. Admission controllers provide a mechanism for proactive governance, preventing problems before they start.
The mental model
An admission controller is like a bouncer at a club's entrance, but for the Kubernetes API server. When you send a request (like kubectl apply), it first passes authentication and authorization. Then, before your object is saved to the cluster's database (etcd), it's handed to the bouncers—the admission controllers. They check your request against a set of rules. Some might modify it (a mutating controller adding a required label), while others just approve or deny it (a validating controller checking for privileged containers). Only if it passes all checks is it allowed in.
How it works
Admission control is a multi-stage process in the API server's request lifecycle. After a request is authenticated and authorized, it goes through two phases. First, it hits the mutating admission controllers. These can change the object in the request, for example, to inject a sidecar container or add default annotations. Second, the (potentially modified) object is passed to the validating admission controllers. These controllers cannot change the object but can reject the request if it violates a policy. If any controller in the chain rejects the request, the entire operation fails and the object is not persisted to etcd.
When to use it
Admission controllers are essential for cluster governance and security. Use them for enforcing security policies, such as blocking containers that run as the root user or don't specify resource limits. They are also used for automation, like automatically injecting a service mesh proxy (e.g., Istio, Linkerd) into every new pod. Finally, they enforce organizational standards, like requiring all resources to have a team label for cost allocation.
When not to use it
Do not use admission controllers for authentication or authorization. Those steps happen before admission control and are handled by other Kubernetes components like RBAC. Also, avoid performing slow, complex, or long-running operations within a controller. They are in the synchronous, critical path of API requests; a slow controller will degrade the performance of the entire cluster control plane.
One canonical example
A common use case is enforcing label requirements. A company can deploy a ValidatingAdmissionWebhook that checks every new Pod for a cost-center label. If a developer tries to create a Pod without that label, the API server passes the request to the webhook. The webhook inspects the Pod's metadata, sees the label is missing, and returns a rejection. The API server then denies the request, and the developer's kubectl apply command fails with an error explaining the policy violation.
Interview question
Which statement best describes the unique role of Kubernetes Admission Controllers?
- a.They grant or deny user requests based on defined roles and permissions.
- b.They verify user credentials and ensure secure access to the Kubernetes API.
- c.They proactively enforce policies and can alter or deny API requests before objects are persisted.Correct
- d.They continuously monitor cluster resources and automatically adjust configurations to maintain desired state.
Why? this is the answer
Admission controllers operate after authentication and authorization, intercepting requests to enforce custom policies and potentially modify or reject objects before they are saved to etcd. Options A and B describe authentication and authorization, which occur earlier in the API request lifecycle. Option D describes the function of controllers like the Deployment controller, which manage running workloads, not API request interception.
Just read this? Test yourself on what you have been reading.
Read the original → kubernetes.io
- #kubernetes
- #api
- #security
- #policy
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on kubernetes — each one lists the topics its interview covers.
See open roles