Kubernetes internalsLesson 1 of 12
How an API Request Gets Stored
A request sent by a dashboard [Create] button or by kubectl apply passes several gates inside the API server before it is stored. Which gate rejects it decides the error the user sees. Authentication and authorization are covered in Who Can Do What (RBAC), and what happens after storage is covered in How a Pod Starts. This lesson focuses on what lies between: admission, storage and conflicts.
Current gate—
Response—
resourceVersion—
RequestResponse / reportWatchAppears in a later step
What you will learn
- Order: authN → authZ → admission → storage
- Why the stored YAML differs from what you sent
- Why one webhook can block all creation
- The difference between "stored" and "applied"
- Why 409 Conflict happens and how to handle it
Errors by gate
| Gate | If rejected | What the user sees |
|---|---|---|
| Authentication | 401 Unauthorized | Logged out, or credentials expired |
| Authorization (RBAC) | 403 Forbidden | No permission. The message names the user, verb and resource |
| Mutating admission | Rarely rejects | The stored YAML looks different from what you sent |
| Schema validation | 422 Unprocessable Entity | A "field is invalid" error |
| Validating admission | 403 or a policy-specific message | "exceeded quota", admission webhook "..." denied the request |
| Webhook server not answering | failed calling webhook | Timeout. Every create in that webhook's scope can fail |
| Storage | 409 Conflict | The name already exists, or someone else changed it first |
Try it yourself
kubectl get pods -n kube-system -v=6 # One HTTP request: method, URL, response code
kubectl auth can-i create deployments -n <namespace> # Would authorization pass, or 403?
kubectl get mutatingwebhookconfigurations,validatingwebhookconfigurations -o custom-columns=NAME:.metadata.name,FAILURE:.webhooks[*].failurePolicy # Webhooks in the path and their failurePolicy
kubectl create deployment demo --image=nginx --dry-run=server -o yaml # Passes every gate but is not stored; see added fields
kubectl get deployment <name> -o jsonpath='{.metadata.resourceVersion}' # Changes on every write
Check yourself
Further reading: Controlling Access to the Kubernetes API · Admission controllers · API concepts — resourceVersion