Use it when kubectl calls fail, are denied or slow.
kube-apiserver
kube-apiserver is the front door of Kubernetes: it authenticates, authorises (RBAC), runs admission controllers, validates objects and stores them in etcd.
1. kubectl get --raw='/readyz?verbose'.
2. 403 → kubectl auth can-i <verb> <res> --as <user>.
3. Webhook errors in the response.
4. API server logs (static pod or managed service).
5. Latency/throttling metrics.
client → authn → authz (RBAC) → admission → validation → etcd
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
kubectl get --raw='/readyz?verbose'Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 How to verify Verify boundary
Check API server Pod logs or service logs on control-plane nodes. Test from a node and from outside to separate network from server problems. Time slow requests with kubectl get pods -v=6.
Step 2 Checks Verify boundary
kubectl get --raw='/readyz?verbose'
kubectl cluster-info
kubectl get apiservices | grep False
kubectl auth can-i create pods --as system:serviceaccount:app:default
All access goes through authentication → authorization (RBAC) → admission (mutating, validating webhooks) → etcd. A failing admission webhook can block all creates; check kubectl get validatingwebhookconfigurations,mutatingwebhookconfigurations.
Step 3 Common failures Narrow the fault
A failing admission webhook can block all creates of a resource type. Expired client certificates cause sudden Unauthorized errors. Large list requests without pagination load the API server and etcd.
401 → authentication; 403 → RBAC (kubectl auth can-i); admission webhooks can reject or slow requests. Check /readyz.
kubectl get --raw='/readyz?verbose'— first check for this topickubectl get pods -o wide— pods, status, node, IPkubectl describe pod <pod>— events and conditionskubectl logs <pod> [-c <c>] [--previous]— container logs (incl. previous crash)kubectl get events --sort-by=.lastTimestamp— recent cluster events
ReferenceWhat it is1 section · depth on demand
How it works
The API server validates objects against their schema, runs admission webhooks, stores the result in etcd and serves watches so controllers learn about changes. It is stateless and can run as several replicas behind a load balancer.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Every change to a cluster passes through the API server in a fixed order:
authentication → authorization (RBAC) → mutating admission → schema validation → validating admission → write to etcd → watch notifications
Knowing the order tells you where a rejected request was stopped.
| Error | Stage |
|---|---|
401 Unauthorized | Authentication: expired token or client certificate |
403 Forbidden … cannot create resource | RBAC authorization |
admission webhook "x" denied the request | Validating admission (policy engine) |
failed calling webhook … context deadline exceeded | A webhook is down; failurePolicy: Fail blocks the request |
field is immutable / Invalid value | Validation |
Worked health check
kubectl get --raw='/readyz?verbose' | grep -v ok # failing checks only
kubectl get --raw='/livez/etcd'
kubectl get apiservices | grep -v True # broken aggregated APIs
kubectl get validatingwebhookconfigurations,mutatingwebhookconfigurations
An aggregated API (for example v1beta1.metrics.k8s.io) with Available=False makes discovery slow and can break kubectl commands that list all resources.
Load protection
API Priority and Fairness queues requests by flow; a flood from one client (for example a controller in a loop) gets throttled with 429 instead of starving others. kubectl get flowschemas,prioritylevelconfigurations shows the current setup, and the metric apiserver_flowcontrol_rejected_requests_total shows rejections.
Common mistakes
- Exposing the API server publicly without restrictions.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.