Back to Blog
Lesson 3 of the Kubernetes: Kubernetes Concepts & Your First Pod course
KubernetesJuly 14, 20265 min read

The Control Plane and the State Store: Kubernetes Architecture

Understand the Kubernetes Control Plane: how the API Server acts as your cluster's gateway and why etcd serves as the essential source of truth.

KubernetesControl PlaneAPI ServeretcdCloud Native

Previously in this course, we explored the Anatomy of a Kubernetes Cluster, where we identified the distinction between Master (Control Plane) and Worker nodes. Now, we zoom in on the "brain" of the operation: the Control Plane.

If the worker nodes are the muscles doing the heavy lifting, the Control Plane is the nervous system. Understanding how it operates is the difference between blindly running commands and actually engineering reliable systems.

The API Server: The Cluster Gateway

The Kubernetes API Server is the only component in the cluster that talks directly to the database. Whether you are using kubectl, a CI/CD pipeline, or an internal cluster controller, every interaction must pass through the API Server.

Think of the API Server as a high-security receptionist. It performs three critical functions:

  1. Authentication and Authorization: It verifies who you are and whether you have permission to perform the requested action.
  2. Validation: Before accepting any change, it ensures your request is syntactically correct and logically valid.
  3. State Proxying: It doesn't "do" the work itself. Instead, it accepts your request and updates the state in the database.

When you send a request (like creating a Pod), the API Server validates the input and writes the object to the data store. It doesn't actually launch the container; it simply records that "a Pod should exist."

etcd: The Single Source of Truth

If the API Server is the gateway, etcd is the memory. It is a distributed, consistent key-value store used to hold the entire state of your cluster.

In distributed systems, keeping track of what is "currently running" versus what "should be running" is notoriously difficult. etcd solves this by being strictly consistent. It uses the Raft consensus algorithm to ensure that all nodes in the Control Plane agree on the current state.

Why does this matter?

If your cluster loses power or nodes crash, the state is safely persisted in etcd. When the components restart, they query etcd to see what the world is supposed to look like and begin reconciling the environment back to that state.

ComponentRoleAnalogy
API ServerGatewayThe Clerk / Receptionist
etcdData StoreThe Ledger / Source of Truth
Controller ManagerOrchestratorThe Manager ensuring the plan is followed

The Interaction Flow

To understand the relationship, consider what happens when you deploy a new application:

  1. Request: You send a manifest to the API Server.
  2. Persistence: The API Server validates the manifest and writes it into etcd.
  3. Notification: The API Server notifies other control plane components (like the Scheduler) that a new task exists.
  4. Action: The Scheduler sees the new entry in etcd, finds a suitable node, and updates the state in etcd to assign the Pod to that node.

This flow is the heartbeat of Kubernetes. It is fundamentally different from traditional server management, where you might SSH into a machine and run a command. In Kubernetes, you simply update the "ledger" (etcd), and the system works to match reality to that ledger.

Hands-on Exercise: Inspecting the Control Plane

While we will set up our full local environment in a later lesson, you can verify this architecture right now if you have access to a cluster.

  1. Identify the API Server: Run kubectl get pods -n kube-system. You will see a pod named kube-apiserver-your-node.
  2. Identify etcd: You will also see etcd-your-node.
  3. The Observation: Notice how these are just standard containers running in the kube-system namespace. They are "dogfooding"—Kubernetes uses its own orchestration capabilities to keep its brain running.

Exercise: Try running kubectl get pods -n kube-system and look at the status of these components. If you see them in a Running state, your cluster's brain is healthy.

Common Pitfalls

  • Treating the API Server as a command executor: Beginners often think the API Server "starts" the container. It doesn't. It just stores the request. The actual work happens on the worker nodes via the Kubelet.
  • Directly modifying etcd: Never, ever touch the etcd database files directly. Always use kubectl or the API. Modifying the store directly bypasses the validation and logic of the API Server, which will inevitably lead to a corrupted or broken cluster.
  • Ignoring etcd backups: Because etcd is the single source of truth, if you lose etcd, you lose the entire cluster configuration. In production, always have a robust backup strategy for your etcd snapshots.

FAQ

Q: Can I run Kubernetes without etcd? A: No. etcd is the fundamental storage engine for Kubernetes state. Without it, the system has no way to remember what is currently deployed.

Q: Is the API Server a bottleneck? A: In very large clusters, it can be. However, it is designed to be horizontally scalable and is optimized for the high-frequency reads and writes required by the cluster's reconciliation loops.

Q: What happens if the API Server goes down? A: Your existing pods will continue to run (because they are managed by the local Kubelet on each node), but you will be unable to modify, update, or scale your cluster until the API Server is restored.

Recap

The Control Plane is the foundation of Kubernetes. The API Server acts as the gatekeeper, ensuring all requests are valid before they are committed, while etcd acts as the cluster's memory, holding the authoritative state of your entire infrastructure.

Up next: We will dive into the Declarative vs. Imperative Models to see exactly how these components process your instructions.

Similar Posts