What is a Kubernetes Node?
In a Kubernetes cluster, a Node is a worker machine (either a virtual or physical machine) responsible for running containerized applications. Each Node contains the necessary components to execute the tasks assigned by the Kubernetes Control Plane, typically hosting one or more Pods.
Core Definition
A Kubernetes Node is essentially a worker machine where containerized applications (packaged as Pods) run. These machines can be either physical servers or virtual machines, depending on the underlying infrastructure. A Kubernetes cluster consists of at least one Control Plane node and multiple worker nodes, with the worker nodes being referred to as Nodes.
Key Components of a Node
For a machine to function as a Kubernetes Node, it must run several essential components. These components allow it to communicate with the Control Plane, manage containers, and provide networking capabilities for Pods.
- Kubelet: An agent that runs on each Node. It communicates with the Control Plane (specifically the API Server) to receive Pod specifications and ensure that the containers described in these PodSpecs are running and healthy.
- Kube-proxy: A network proxy that runs on each Node, responsible for maintaining network rules on the Node. It enables network communication to your Pods from inside or outside of your cluster by handling service discovery and load balancing for services.
- Container Runtime: Software responsible for running containers. Kubernetes supports various container runtimes such as containerd, CRI-O, and earlier versions also supported Docker (via dockershim, which is deprecated as of Kubernetes 1.24).
Node Management and Status
The Kubernetes Control Plane manages the lifecycle of Nodes. When a Node comes online, its Kubelet registers it with the Control Plane. The Kubelet then continuously sends status updates about the Node's health, resources, and the Pods running on it. If a Node becomes unhealthy or unreachable, the Control Plane can reschedule its Pods to other healthy Nodes.
kubectl get nodes
This command provides an overview of the nodes in your cluster, showing their names, status (Ready, NotReady), roles, age, and Kubernetes version.
Interaction with the Control Plane
The Control Plane (specifically the Scheduler) decides which Node a Pod should run on, based on resource requirements, constraints (like Node Selectors or affinity/anti-affinity rules), and current Node load. The Kubelet on the chosen Node then takes responsibility for starting and managing the Pod's containers, reporting their status back to the Control Plane.