What are Kubernetes Nodes ?
A Kubernetes node is a machine that runs containerized workloads as part of a Kubernetes cluster. A node can be a physical machine or a virtual machine, and can be hosted on-premises or in the cloud. A Kubernetes cluster can have a large number of nodes.
Kubernetes nodes features
You can host a node in the cloud or in a data center (on-premises). Nodes contain the Kubernetes control plane, pods, and the containerized application.
A node can host a single or multiple pods. A K8s node delivers the CPU, memory, and networking capabilities in a Kubernetes cluster (internal and external communications).
When one node in a cluster fails another takes over its work to ensure service continuity. Nodes in a cluster are interconnected to ensure efficient load balancing and working synchronously.
Master nodes
Master nodes runs the Kubernetes control plane which controls the entire cluster. A cluster must have at least one master node; there may be two or more for redundancy. Components of the master node include the API Server, etcd (a database holding the cluster state), Controller Manager, and Scheduler.
Worker nodes
These are nodes on which you can run containerized workloads. Each node runs the kubelet-an agent that enables the Kubernetes control plane to control the node. Kubernetes nodes are used by organizations to run a variety of workloads, as a core component in modern DevOps processes.
Kubernetes Node Components
Kube API server handles administrative tasks on the master node. Users send REST commands in YAML/JSON to the API server, which processes and executes them. The Kube API server acts as the front end of the Kubernetes control plane.
etcd a distributed key-value store, maintains the cluster state and configuration details like subnets and config maps in Kubernetes’ database. It’s where Kubernetes stores its information.
Kube-Scheduler assigns tasks to worker nodes and manages new requests from the API Server, ensuring they are directed to healthy nodes.
Kube Controller Manager task is to retrieve the desired state from the API Server. If the desired state does not match the current state of the object, corrective steps are taken by the control loop to align the current state with the desired state.
Kubelet an agent on each node, communicates with the master. It ensures pod containers’ health, executing tasks like deploying or destroying containers, reporting back to the Master.
Kube-proxy enables worker node communication, managing network rules. It ensures rules are set for containers to communicate across nodes.
AKubernetes pod is a set of containers on a single host, sharing storage and network. It includes specifications for container execution, enabling easy inter-container communication.
Container Runtime, responsible for container execution, supports multiple runtimes: Docker, containers.
How Many Kubernetes Nodes Should be in a Cluster?
Here are three criteria you can use to determine the optimal number of nodes in your Kubernetes cluster:
Performance: Simply put, more nodes enable you to run workloads with higher performance. Each node adds more compute and memory resources to the cluster. Some nodes might add special hardware resources like high-speed storage or graphical processing units (GPUs). A rule of thumb is to have about 20% more computing resources than the expected workloads, to allow for peaks and node failures.
High availability: Additional nodes in a cluster can enable high availability strategies, such as running multiple instances of the same pod. You can also use some of the nodes as redundancy for the master node, which is a single point of failure.
Bare metal or virtual machines (VMs): You can add nodes to the cluster by adding more physical machines or running additional VMs on the same bare metal machine. In the cloud, when using services like Amazon EC2, all resources are virtualized. VMs are less reliable than physical machines because if a machine fails, all the VMs (nodes) running on it shut down. However, VMs are more cost-effective.
What are Kubernetes node status conditions?
Node conditions provide information about the health of several key node attributes and metrics. These include the amount of CPU, RAM, and pod capacity in use. You use the kubectl to do a node status check. Conditions also determine if a particular node should have pods scheduled for it.
Node Condition | Description |
Ready | True if the node is healthy and ready to accept pods, False if the node is not healthy and is not accepting pods, and Unknown if the node controller has not heard from the node in the last node-monitor-grace-period (default is 40 seconds) |
DiskPressure | True if pressure exists on the disk size—that is, if the disk capacity is low; otherwise False |
MemoryPressure | True if pressure exists on the node memory—that is, if the node memory is low; otherwise False |
PIDPressure | True if pressure exists on the processes—that is, if there are too many processes on the node; otherwise False |
NetworkUnavailable | True if the network for the node is not correctly configured, otherwise False |