Node
What is a Node?
Kubernetes runs workloads by placing containers in pods and running them on nodes
A node can be a
virtual or physical machinedepending on the clusterEach node is managed by the
control planeand contains the services necessary to run podsThe components of a node include
kubelet,kube-proxy, and thecontainer runtime-> Refer to Cluster!
Managing Nodes
There are two main ways to add a node to the Kubernetes API server
Self-registration to the control plane via the node's
kubeletA user (or another user) manually adds the
node object
After registration via kubelet or node object, the control plane verifies that the created node object is valid
ex)
{
"kind": "Node",
"apiVersion": "v1",
"metadata": {
"name": "10.240.79.157",
"labels": {
"name": "my-first-k8s-node"
}
}
}
Flow
Kubernetes internally creates a
node objectKubernetes checks whether the
kubeletis registered with the API server matching the node'smetadata.namefieldIf the node is healthy,
It becomes eligible to run pods
If it is not healthy,
The node is ignored for all cluster activities until it becomes healthy
Kubernetes `retains` invalid `node objects` and `checks whether the node is healthy`
To stop the health check, the user or a controller must explicitly delete the node object
Uniqueness of Node names
Two nodes cannot have the same name at the same time
Kubernetes assumes that resources with the
same nameare thesame object!
For nodes, it is implicitly assumed that instances using the same name have the
same state(ex. network settings, root disk contents) and thesame attributessuch as node labelsIf an instance is modified without changing its name, this can lead to inconsistencies!
Therefore, when replacing or updating a node, you must first
remove the existing node object from the API serverand re-add it after the update!
Node Status
A node's status includes the following information
Addresses
Conditions
Capacity and Allocatable
Info
Check node status and details using kubectl
The information output by the above command includes addresses, conditions, capacity and allocatable, and info as described below.
Addresses
The
addressesfield varies depending on the cloud provider or bare metal setup
HostName
The hostname as reported by the node's kernel
Can be overridden via the
-hostname-overrideparameter
ExternalIP
Typically, the node's IP address is externally routable
That is, it is accessible from outside the cluster
InternalIP
Typically, the node's IP address is only routable within the cluster
Conditions
The
conditionsfield describes allRunningstate nodes
Ready
True if the node is healthy and ready to accept pods, False if the node is unhealthy and not accepting pods, Unknown if the node controller has not received a response from the node within the last node-monitor-grace-period (default 40 seconds)
DiskPressure
True if there is pressure on disk size, meaning disk capacity is low, False otherwise
MemoryPressure
True if there is pressure on node memory, meaning node memory is low, False otherwise
PIDPressure
True if there is pressure on processes, meaning there are many processes on the node, False otherwise
NetworkUnavailable
True if the network for the node is not correctly configured, False otherwise
Capacity and Allocatable
Represents the
available resourceson a nodeResources include CPU, memory, and the maximum number of pods that can be scheduled on the node
The capacity block fields represent the
total amount of resources on the nodeThe allocatable block represents the amount of node resources available for regular pods
Info
Describes general information about the node such as
kernel version,Kubernetes version(kubelet and kube-proxy versions),container runtime details, andthe operating systemthe node usesThis information is collected by kubelet from the node and sent to the Kubernetes API
Last updated