Pcornel
Browse topics
Options
Recent
Favorites
Containers · Technical reference

kube-apiserver

Direct answer

kube-apiserver is the front door of Kubernetes: it authenticates, authorises (RBAC), runs admission controllers, validates objects and stores them in etcd.

When to use this

Use it when kubectl calls fail, are denied or slow.

First 30 seconds

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.

Operational verification

client → authn → authz (RBAC) → admission → validation → etcd

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Docker / containerd / Podman / Kubernetes / OCI-compatible platforms
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformDocker / containerd / Podman / Kubernetes / OCI-compatible platforms
Key commandkubectl get --raw='/readyz?verbose'
Scope / prerequisiteUse it when kubectl calls fail, are denied or slow.
What next?2 suggested next steps
Evidence0
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

3 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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.

Key points

401 → authentication; 403 → RBAC (kubectl auth can-i); admission webhooks can reject or slow requests. Check /readyz.

Key checks
  • kubectl get --raw='/readyz?verbose' — first check for this topic
  • kubectl get pods -o wide — pods, status, node, IP
  • kubectl describe pod <pod> — events and conditions
  • kubectl 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.

ErrorStage
401 UnauthorizedAuthentication: expired token or client certificate
403 Forbidden … cannot create resourceRBAC authorization
admission webhook "x" denied the requestValidating admission (policy engine)
failed calling webhook … context deadline exceededA webhook is down; failurePolicy: Fail blocks the request
field is immutable / Invalid valueValidation

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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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
Terminology layer

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.

Aliases that resolve here
kube-apiserverkube-apiserverkubernetes admission
Confirmation

Confirm action

Continue?