Skip to main content
Admission Controllers are plugins that intercept requests to the Kubernetes API server after authentication and authorization but before they’re persisted in etcd. They enable cluster operators to enforce policies, mutate objects, or perform background actions automatically.

Kubernetes API Request Flow

When you run a kubectl command (e.g., creating a Pod), the request follows these steps:
  1. Authentication (AuthN): Verify user identity (usually via certificates in your kubeconfig).
  2. Authorization (AuthZ): Check if the requester has permission (via RBAC, ABAC, Node, Webhook).
  3. Admission Control (Admission Controllers): Validate or mutate objects.
  4. Persistence: Store the final object in etcd.
The image is a flowchart illustrating the process of creating a pod in Kubernetes, involving steps like authentication, authorization, and admission controllers.

Authentication & Authorization Examples

kubeconfig Snippet

RBAC Role for Pod Operations

You can further restrict to specific Pod names:

Why Admission Controllers?

RBAC governs who can perform what at the API surface. It cannot inspect or change the contents of an object. For example, you may want to enforce:
  • Only use images from an internal registry
  • Disallow :latest tags
  • Prevent containers from running as root
  • Inject security capabilities or sidecars
  • Require specific labels or annotations
Admission Controllers can validate (reject bad requests) or mutate (inject defaults, sidecars) before persistence.

Built-in Admission Controllers

Kubernetes includes many Admission Controllers out of the box. Below is a summary of some common ones:

Namespace Admission Controllers

NamespaceExists

By default, creating resources in a namespace that doesn’t exist yields:

NamespaceAutoProvision

NamespaceAutoProvision (disabled by default) automatically creates a namespace if it doesn’t exist when you submit a request.

Viewing Enabled Admission Controllers

On kubeadm-based clusters:

Enabling an Admission Controller

Update the API server’s startup arguments:
Editing the kube-apiserver flags requires careful coordination. After changes, restart the API server or apply the updated control-plane manifest.
Example (systemd service):
Example (kubeadm Pod manifest):
Now, creating a Pod in a new namespace will auto-create it:

NamespaceLifecycle Admission Controller

The NamespaceLifecycle plugin supersedes both NamespaceExists and NamespaceAutoProvision. It:
  • Rejects requests to unknown namespaces
  • Prevents deletion of critical system namespaces (default, kube-system, kube-public)

Watch Video

Practice Lab