Google Cloud Platform – Concept of Nodes in Kubernetes
In this article, we will figure out how Kubernetes actually runs containers on nodes. Let’s go over the concepts that make Kubernetes usable, scalable, and just downright awesome. A node is a virtual or physical machine that you run your workloads on. In Kubernetes, we operate on clusters, which are groups of one or more worker nodes. But in order to get the automation that Kubernetes provides, nodes are more than just any old virtual or physical machine.
Each node actually contains the services necessary to run pods. A container run time for running containers, a kubelet for making sure that everything that should be running is, and the kube-proxy for handling networking.
That’s how Kubernetes keeps track of pods. That also explains how pods get IP endpoints and other necessary features for running at scale, like being able to attach to a running pod for debugging.
Now, if we had to manually manage all the pods on each node, it would be impossible to handle. That’s one of the most important reasons Kubernetes exists. The way Kubernetes actually manages these pods is through what’s called the control plane. The control plane is responsible for handling all of these details by exposing an API. This is where Kubernetes can define, deploy, and manage the lifecycle of our pods. There’s a lot going on in the control plane.
Let’s look at some components that make up the control plane and what they do. First, there’s the API server itself, which handles data validation and configuration for all the API objects. Next, there’s etcd, which is a key-value store for holding onto all the important data that Kubernetes uses. Plus, there’s the Scheduler. Here’s where the important decisions get made about where exactly a pod will run. The Scheduler can look at the available resources for all the nodes and make sure that a pod goes to a node that can handle it.
The Controller Manager, where the core Kubernetes logic happens. One of the big responsibilities here is lifecycle management, to make sure all the various pieces are working correctly. Similarly, there is the Cloud Controller Manager, which lets Kubernetes hook into cloud providers. So if you’re running Google Kubernetes Engine, the Cloud Controller Manager is what speaks to Google Cloud when something is needed, like a new virtual machine for a node.
The kubelets on the nodes are watching what’s going on in the node itself. So when the control plane needs to schedule a pod on that node, both the control plane and the node itself have enough information to make sure it works. Plus, if a pod runs into an issue, the control plane will work with the kubelet to remove the unhealthy pod and replace it with a new one.