Hello! Welcome back to your Kubernetes crash course.
In the last two lessons, we've explored the architecture of a Kubernetes cluster, covering the control plane components that make decisions and the worker node components that execute the work. You now know that the scheduler decides where Pods should run and the kubelet on the worker node makes it happen.
Today, we're going to zero in on the absolute core of the control plane: the API server and etcd. This duo acts as the cluster's central gateway and its persistent memory. By the end of this lesson, you will be able to explain exactly how the API server handles requests and the critical role etcd plays in storing the cluster's state. Understanding this is key to grasping how your kubectl commands translate into running applications.
The Cluster's Gateway and Brain
At the heart of the control plane, the API server and etcd work in a tight, exclusive partnership.
- The API Server is the front door for the entire Kubernetes control plane. Every interaction—from you using
kubectl, to controllers watching for changes, to kubelets reporting status—goes through the API server. etcdis a distributed key-value store that serves as Kubernetes' single source of truth. It stores the configuration and state of every object in the cluster.
Crucially, the API server is the only component that is allowed to talk directly to etcd. This centralizes access, validation, and security, forming a robust foundation for the entire system.
Let's start with a video that recaps the roles of all control plane components, paying special attention to how the API server and etcd are positioned.
Kubernetes Architecture explained | Kubernetes Tutorial 15
This video from 'TechWorld with Nana' provides a great overview of the control plane components. Focus on its description of the API server as the 'cluster gateway' and etcd as the 'cluster brain'.
Watch the segments on the API server (05:19 - 06:36) and etcd (08:58 - 10:32). Note how the API server acts as a gatekeeper and how all cluster information is stored in etcd.
etcd: The Single Source of Truth
As the video explained, etcd is the database for your Kubernetes cluster. Your experience with distributed systems will help you appreciate its design.
- What it is:
etcdis a consistent and highly-available key-value store. It's "distributed" because it typically runs on multiple master nodes and uses the Raft consensus algorithm to ensure that all nodes agree on the cluster's state. This provides fault tolerance; the cluster can lose a master node without losing its state. - What it stores: It stores the complete state of the cluster, both the desired state (what you want to be running, e.g., "I want 3 replicas of my Nginx app") and the actual state (what is currently running, e.g., "2 replicas are running, 1 is pending"). This data is organized in a key-space, with paths like
/kubernetes.io/pods/default/my-pod. - The Watch Mechanism: This is
etcd's most powerful feature in the context of Kubernetes. Clients (specifically, the API server) can "watch" for changes on specific keys or directories. When a key is updated,etcdnotifies the watcher. This event-driven model is what allows the entire Kubernetes system to be so responsive and loosely coupled.

To solidify your understanding of etcd's role and this critical watch feature, the following reading provides a clear explanation.
Kubernetes Master Components: Etcd, API Server...
This article by Jorge Acetozi explains etcd's function clearly and highlights the importance of its 'watch' feature.
Read the section titled 'Etcd'. Pay close attention to its role as the source of truth and the description of the 'watch' feature.
A Request's Journey Through the API Server
Now that we know where the state is stored, let's trace the path of a request to understand how the API server processes it before it ever reaches etcd. When you run a command like kubectl apply -f deployment.yaml, your request goes on a multi-stage journey inside the API server.

The following video provides an excellent and concise walkthrough of this entire process.
This video from Salman Iqbal provides a fantastic, step-by-step breakdown of what happens inside the API server when it receives a request.
Watch the entire video (00:00 - 05:32). It will guide you through each stage of the request lifecycle, from the initial HTTP request to its final persistence in etcd.
Let's break down those stages:
-
HTTP Handling: The journey begins here.
kubectlconverts your YAML manifest into a JSON payload and sends it as an HTTP request to the API server's endpoint. -
Authentication: The first security gate. The API server needs to know who is making the request. It checks for credentials (like a client certificate or a bearer token) and verifies the identity of the user, group, or ServiceAccount. If authentication fails, the request is rejected immediately.
-
Authorization: The second security gate. Once the user is authenticated, the API server determines if they have permission to perform the requested action. For example, "Is this user allowed to
createdeploymentsin theproductionnamespace?" This is typically handled by the Role-Based Access Control (RBAC) subsystem. -
Admission Control: This is a powerful and extensible gatekeeping stage. After a request is authenticated and authorized, it's intercepted by one or more Admission Controllers. These are plugins that can examine, modify, or even reject the request before it's persisted. There are two types:
- Mutating Admission Controllers: These can change the object. A common use case you might recognize from your work with Envoy is injecting a sidecar proxy container into every Pod created in a namespace. Another example is setting a default
storageClassfor a PersistentVolumeClaim if one isn't specified. - Validating Admission Controllers: These can reject the object based on custom policies, but cannot change it. For example, a validating controller could enforce a policy that all container images must come from a trusted corporate registry, or that all Pods must have resource limits defined.
- Mutating Admission Controllers: These can change the object. A common use case you might recognize from your work with Envoy is injecting a sidecar proxy container into every Pod created in a namespace. Another example is setting a default
-
Schema Validation & Persistence: After passing through all admission controllers, the object is validated against the internal schema for that resource type. If it's valid, the API server serializes it (often using an efficient format like Protobuf) and writes it to
etcd.
Only after the object is successfully written to etcd is the request considered complete. At this point, etcd sends a notification back to the API server, which in turn notifies other components (like the scheduler or controller manager) that are watching for these changes, triggering the next set of actions.
Test your understanding!
A platform team wants to enforce a new policy: all Pods created in the cluster must include a cost-center label. If a developer tries to create a Pod without this label, the request should be denied with an informative error message.
Which stage of the API server request lifecycle is the correct place to implement this logic?
- Authentication
- Authorization
- Mutating Admission Control
- Validating Admission Control
Show answer
4. Validating Admission Control
This is the perfect use case for a Validating Admission Controller.
- Authentication only verifies who the user is.
- Authorization only verifies if the user has permissions (e.g., to
createpods), not the content of the pod manifest. - Mutating Admission Control could potentially add the label, but the goal here is to reject the request and enforce the policy on the user.
- A Validating Admission Controller can inspect the incoming Pod object and reject it if the
cost-centerlabel is missing, fulfilling the requirement perfectly.
Conclusion
In this lesson, you've taken a close look at the communication hub and memory of the Kubernetes cluster. You now have a solid mental model of how state is managed and how user intent is processed.
Key Takeaways:
etcdis the cluster's consistent and highly-available key-value store. It is the single source of truth for all cluster data.- The API server is the central management endpoint. It is the only component that communicates directly with
etcd, acting as a gateway for all other components. - Requests to the API server undergo a strict, multi-stage pipeline: Authentication (who are you?), Authorization (can you do this?), and Admission Control (does this request meet our policies?).
- Admission Controllers (both Mutating and Validating) are powerful plugins for enforcing custom policies and automating modifications, a key area of interest for Platform Engineers.
In our next lesson, we will build directly on this foundation. Now that you understand how the API server stores state in etcd, we'll explore the philosophy behind that state by discussing declarative management. You'll learn why telling Kubernetes "what you want" is far more powerful than telling it "what to do."