Skip to main content
This guide walks through the solutions for the Admission Controllers lab questions. Each step shows the commands used to inspect and modify the kube-apiserver configuration and explains the rationale behind each answer. These notes assume a control-plane with kube-apiserver running as a static pod (typical on single-node control-plane setups or kubeadm clusters). Quick links Summary table (quick answers)

Q1 — Which of these is NOT a function of admission controllers?

Answer: Authenticate users. Explanation
  • Admission controllers run after authentication and authorization have already taken place.
  • Their role is to validate or mutate API requests (for example, enforce quotas, set defaults, restrict node changes, or call webhooks).
  • Authentication (establishing identity of the caller) is handled earlier in the request pipeline; admission controllers do not perform authentication.
Reference: Kubernetes request processing order and admission controllers docs.

Q2 — Which admission controller is NOT enabled by default?

How to check
  • Inspect the kube-apiserver help text for the --enable-admission-plugins flag to see which admission plugins are enabled in addition to defaults.
  • On a static-pod control plane, you can run the kube-apiserver binary from inside the API server pod to print the help output.
Commands:
Sample (trimmed) output:
Conclusion
  • From the list above, MutatingAdmissionWebhook and ValidatingAdmissionWebhook are present, but NamespaceAutoProvision is not.
  • Therefore, NamespaceAutoProvision is not enabled by default in this cluster.

Q3 — Which admission controller is enabled in this cluster that is normally disabled?

How to check
  • Inspect the kube-apiserver static pod manifest on the control-plane host, usually at /etc/kubernetes/manifests/kube-apiserver.yaml, or grep the running manifest for enable-admission-plugins.
Commands:
Sample output:
Conclusion
  • This shows that NodeRestriction has been explicitly enabled in the manifest.
  • NodeRestriction can be off by default in some upstream defaults and was added on this cluster — that is the admission controller that is explicitly enabled here.

Q4 — Create an nginx Pod in the blue namespace (namespace not pre-created)

Scenario
  • The lab required creating a Pod in the blue namespace, but the blue namespace does not exist and the lab forbade pre-creating the namespace manually.
Attempt (expected failure):
Result:
Why it failed
  • Requests targeting a non-existent namespace are rejected by the API server.
  • Historically, admission plugins such as NamespaceAutoProvision could automatically create a namespace when a request referenced it.
  • Most modern clusters do not enable NamespaceAutoProvision by default (and the plugin is deprecated in newer Kubernetes versions).
How to satisfy the lab requirement
  • The lab expects you to enable the legacy behavior: add NamespaceAutoProvision to the enabled plugins list of kube-apiserver.
  • Edit the kube-apiserver static pod manifest and add NamespaceAutoProvision to --enable-admission-plugins.
Example change: Current line:
Update to:
Steps
  1. Edit /etc/kubernetes/manifests/kube-apiserver.yaml and modify the --enable-admission-plugins value as shown.
  2. Save the file; kubelet will detect the manifest change and recreate the static pod.
  3. Wait until kube-apiserver is ready again, then retry creating the Pod:
Sample resulting namespaces:
Important note
  • NamespaceAutoProvision is deprecated in recent Kubernetes releases. Newer Kubernetes versions rely on NamespaceLifecycle and other supported mechanisms. Prefer supported patterns for production clusters.
The NamespaceAutoProvision admission controller is deprecated and replaced by NamespaceLifecycle in recent Kubernetes releases. Prefer the newer controller and supported workflows for namespace management.

Q5 — Disable the DefaultStorageClass admission controller

Goal
  • Disable the DefaultStorageClass admission controller so it no longer runs during admission.
How to do it
  • Add the plugin name to the --disable-admission-plugins flag in the kube-apiserver static pod manifest.
Example manifest excerpt (before):
Add/modify disable flag:
Notes
  • Ensure the --disable-admission-plugins flag includes DefaultStorageClass.
  • After saving the manifest, kubelet recreates the kube-apiserver static pod using the updated arguments. Wait for the API server to restart and become ready before validating behavior changes.
Example manifest context (trimmed):
Verification tips
  • After kube-apiserver restarts, try creating PVCs or observe default storage class behavior to confirm the controller is no longer mutating requests.

Q6 — Verify enabled and disabled admission plugins on the running kube-apiserver

Methods to verify
  1. Inspect the running kube-apiserver process on the control-plane node
  • The resulting process command line includes --enable-admission-plugins and --disable-admission-plugins arguments and their values.
  • This shows the effective flags the process is running with.
  1. Inspect the static pod manifest used by kubelet
  • The manifest is the authoritative configuration that kubelet uses to create the kube-apiserver static pod.
  • If you modified the manifest to enable/disable plugins, this is the file to check.
  1. Alternative: use the kube-apiserver help text from within the static pod
Replace <kube-apiserver-pod-name> with the actual pod name (e.g., output from kubectl get pods -n kube-system).
References and further reading

Watch Video