Kubernetes node
What is Kubernetes node?
A Kubernetes node is a logical collection of IT resources that runs workloads for one or more containers in a Kubernetes cluster.
Nodes contain the services necessary to run pods (Kubernetes' term for groups of containers that operate together), communicate with control plane components, configure networking and run assigned workloads. Each node can host one or multiple pods.
How does a Kubernetes node work?
In Kubernetes, each node has the services needed to create the runtime environment and support pods. These components include a container runtime, such as containerd; kube-proxy, the Kubernetes network proxy; and kubelet, a Kubernetes controller.
Kubernetes choreographs the deployment and scaling of containerized applications rather than necessary hardware systems. Nodes are collections of resources defined by the hosting infrastructure, whether in the cloud or on a physical or virtual machine (VM). A node's host environment can optionally be specially tailored to the application in question.
When a user creates a node, Kubernetes creates a node object that represents the node and then ensures its proper functionality. Pods run on nodes with appropriate available resources for the workload that meet the pod's requirements for affinity or anti-affinity with other pods.
Kubernetes node management
Kubernetes node interfaces involve interactions among three components: the node controller, the kubectl command-line interface (CLI) and kubelet.
The node controller manages aspects of a Kubernetes node throughout its lifecycle. If the user relies on Classless Inter-Domain Routing (CIDR) assignment, the node controller assigns a CIDR block to the node upon registration. The node controller also maintains a list of internal nodes in tandem with available machines, monitors node health and removes pods from unreachable nodes.
When a node is unhealthy, the node controller checks the availability of the node's underlying resources and deletes the node if those resources are unavailable. Updates to the Kubernetes platform have improved the node controller's ability to manage networking issues in large numbers of nodes by evaluating an entire cluster before evicting a pod.
Kubectl is a CLI that lets users run commands against a Kubernetes cluster. For example, the administrator can run a kubectl command to prevent Kubernetes from scheduling pods on a particular node.
Kubelet is an agent that runs on each Kubernetes node, where it handles the pods for that node and communicates information to and from the control plane.
Node capacity
Self-registering Kubernetes nodes report capacity in terms of CPU and memory volume when the node object is created. Alternatively, administrators can manually set the capacity demands upon node creation.
The Kubernetes scheduler assigns sufficient resources to all pods on a node and ensures that requests do not outstrip node capacity. Kubernetes operates on the assumption that a dedicated subnet is available to each node server.
Node status
Kubernetes node status data includes the addresses of the resources compiled into a node, pod condition, capacity and information.
There are three options for node addresses, depending on cloud environment and bare-metal configuration:
- HostName as reported by the node's kernel, which can be replaced using the kubelet parameter --hostname-override;
- ExternalIP, corresponding to the node's IP address accessible from outside the cluster; and
- InternalIP, corresponding to the node's IP address only routable within the cluster.
Conditions refer to the status of all running nodes and are reported as True or False. Examples of the many possible node conditions include OutOfDisk, denoting available disk space; Ready, denoting node health; and NetworkUnavailable, denoting configuration information.
Capacity describes available node resources: CPU, memory and the maximum number of pods the node can handle.
Information offers general stats, such as versions and names. These include OS name and version numbers for the kernel, kubelet, kube-proxy and Docker, if using Docker containers.