Interview Prep/Kubernetes/Architecture & Control Plane

What does the kube-apiserver do?

BeginnerConceptArchitecture & Control Plane
Answer

Short answer

The kube-apiserver is the front door of the Kubernetes cluster. Every request — from kubectl, from other components, from CI/CD tools — goes through it. It checks who you are, whether you're allowed, validates the request and saves it to etcd.

Explained in simple words

Imagine the reception desk of a secure office building. Nobody walks straight into the offices. Everyone stops at reception, shows ID, gets checked against a visitor list, and only then is allowed in — and reception writes everything in the register. The API server is that reception desk, and etcd is the register.

How it works, step by step

When you run kubectl apply -f pod.yaml, the API server:

  1. Authenticates — who are you? (certificate, token, cloud IAM)
  2. Authorizes — are you allowed to do this? (RBAC rules)
  3. Runs admission controllers — these can change or reject the request (for example, add default values, or block Pods running as root).
  4. Validates — is the YAML correct for this kind of object?
  5. Saves to etcd — the object now officially exists.
  6. Notifies watchers — the scheduler, controllers and kubelets are watching the API server and react to the change.

Example

kubectl get pods -v=6
# shows the real HTTP call:  GET https://10.0.0.1:6443/api/v1/namespaces/default/pods 200 OK

kubectl get --raw='/readyz?verbose' | tail -3   # API server health checks
kubectl api-resources | head                     # every object type the API server serves

-v=6 is a useful trick to show an interviewer that kubectl is just an HTTP client talking to the API server.

Key facts:

  • It's a REST API over HTTPS, usually on port 6443.
  • It's stateless (all state lives in etcd), so in production you run several API servers behind a load balancer for high availability.

What to say in the interview

"The API server is the central entry point of the cluster. Every request goes through it — from kubectl, from controllers, from the kubelet. It authenticates the caller, authorizes the action with RBAC, runs admission controllers that can modify or reject the request, validates the object and stores it in etcd. Other components watch the API server for changes and react. It's stateless, so we run multiple replicas behind a load balancer for high availability."

Follow-up questions you may get

  • What port does it use? 6443 by default.
  • What is an admission controller? A plugin that can modify (mutating) or approve/reject (validating) requests before they are saved — for example, injecting a sidecar or enforcing security policies.
  • How do you check if the API server is healthy? kubectl get --raw='/readyz?verbose' or check the kube-apiserver Pod in kube-system.
All Kubernetes questions Roadmap: Kubernetes core

More on Architecture & Control Plane