Kubernetes 101 : Node affinity

Node affinity means the ability to schedule a pod on a specific node.
We could use it if we have nodes with specific characteristics, like fast memory, fast CPU, ...

We start by getting a list of our kubernetes nodes, so we could pick our target node for the pod:

We label our node "
worker-node-1" with the label "ram=fast": 

We check the labels of the nodes:

Below if the Yaml configuration file of a pod to be scheduled on a node with the label "ram=fast":

We create our pod using the below command:

Then we check if our pod was deployed on the node "worker-node-1" labeled "ram=fast" using the below command:


Leave as a comment: