Inside the control plane

What each control plane component does, from the API server and etcd to the scheduler, the controller manager and the cloud controller manager.

GazeekKUBERNETES FUNDAMENTALS·LESSON 6
LESSON 6

Inside the control plane

What each control plane component does, from the API server and etcd to the scheduler, the controller manager and the cloud controller manager.

0:00 / 4:07

Diagrams in this video · 1Free in archhy

Copy and edit in archhy: Everyone calls the API server (new tab)

Now try it on a real cluster

The videos are free. Gazeek's hands-on labs give you a real Kubernetes cluster in your browser for every lab, with checks that tell you when you've got it right: the practice the CKA and CKAD exams need.

The diagrams, full size

Copy any of them into archhy, free, and change it for your own system.

After this lesson you can

  • Explain why the API server is the front door of the cluster
  • Describe etcd as the store for all cluster data
  • Explain how the scheduler picks a node for a new Pod
  • Describe controllers as loops that move current state toward desired state
  • Say when a cluster has a cloud controller manager
Transcript

Inside the control plane

Space Llama here, reporting from mission control. Last time, we saw the whole cluster. Today, we go inside the control plane. We'll meet the API server, etcd, the scheduler, the controller manager and the cloud controller manager. Five components. One job each.

The API server

The API server is the front end of the control plane. Its program is called kube-apiserver. It exposes the Kubernetes API. That's how you, and every other component, talk to the cluster. kubectl calls it. The scheduler calls it. The nodes call it. Nobody goes around it. It can scale out by running several copies, with traffic shared between them.

etcd

etcd is a consistent, highly available key-value store. Kubernetes keeps all of its cluster data there. Every object you create, and its current status. The other components don't read etcd directly. They ask the API server, and the API server talks to etcd. Because everything lives there, the docs are clear. Have a backup plan for etcd.

The scheduler

The scheduler, kube-scheduler, watches for newly created Pods that have no node yet. For each one, it picks a node to run it on. It weighs what the Pod needs, like CPU and memory, plus any rules about where it may or may not go. Affinity, for example, is a rule that says run near this, or away from that. Then it records its choice. It doesn't start the Pod. That's the node's job, as we'll see next lesson.

The controller manager

The controller manager, kube-controller-manager, runs controllers. A controller is a control loop. It watches the state of the cluster, then makes or requests changes where needed. Think of a thermostat. You set the temperature you want. It keeps switching the heat on and off to get there. That's desired state versus current state. A controller keeps moving one toward the other. Each controller is separate in principle, but they're compiled into one program and run as one process. Simpler that way. The node controller, for example, notices when a node stops responding. The Job controller runs Pods for one-off tasks.

Controller manager vs cloud controller manager

There's a second controller manager, the cloud controller manager. It holds the cloud-specific logic, and links your cluster to your cloud provider's API. It checks with the cloud when a node disappears, sets up network routes, and creates cloud load balancers. On your own servers, or on your laptop, there's no cloud controller manager at all.

Everyone calls the API server

Here's mission control on one page. In the middle, the API server. Almost every line on this picture ends there. Beside it, etcd. Only the API server reads and writes it. Above, the scheduler, the controller manager and the cloud controller manager. Each one watches the API server, and acts through it. The cloud controller manager also talks to the cloud provider's API, over on the right. From outside, you call in with kubectl, and every node's kubelet calls in too. Nobody goes around it.

Recap

Let's recap. The API server is the front door. Everything goes through it. etcd stores all the cluster's data. Back it up. The scheduler picks a node for each new Pod. Controllers keep moving the current state toward the desired state. And the cloud controller manager links the cluster to a cloud provider, when there is one.

Practice and what's next

That's mission control. Fewer buttons than you'd think. Try the free Kubernetes practice questions at Gazeek Labs, then see it for real in a hands-on lab. Next lesson, Inside a node. See you there.

Hands-on labs

Now try it on a real cluster

A real Kubernetes cluster in your browser for every lab, checked as you go.

See the labs

Gazeek Flash · free

Exam questions on your phone

Free questions on Cluster architecture: quick-fire batches and timed exams, on the web or Android.