Who are you, may you do this, and does policy allow this exact object?
Authentication, authorization and admission run in strict order. Only a request that passes all three is written to etcd.
1 Authentication
Who are you?
Client certificate, bearer token, OIDC identity, or a ServiceAccount token. Failure: 401.
2 Authorization
Are you allowed?
Usually RBAC: may this identity create a Deployment in shop? Failure: 403.
3 Admission
Is this object acceptable?
Looks at the content: defaults, quotas, Pod Security, webhooks. Can mutate or reject.
4 Persist
Written to etcd
Only now is the desired state stored. Controllers see it through a watch.
Built-in admission controllers worth knowing
| LimitRanger | fills default requests and limits |
| ResourceQuota | rejects objects that exceed the namespace quota |
| PodSecurity | enforces privileged, baseline or restricted |
| DefaultStorageClass | assigns a class to a PVC that names none |
what each failure looks like
$ kubectl get pods --token=bad error: You must be logged in (401) $ kubectl create deploy x --image=nginx forbidden: cannot create resource "deployments" (403) $ kubectl apply -f big-pod.yaml exceeded quota: shop-quota, requested: cpu=40