NodeSelector
This is an important property for the deployment file.
nodeSelector property when attached to a deployment, deploys it onto the same very node which has the same label mentioned.
The label of the node can be found out using the command:
kubectl get nodes — show-labels
Please find a portion of the deployment file below with nodeSelector property
This deployment file will be deployed only on that node which has nodeSelector label property.
In case the node doesn’t have the same nodeSelector(here, prod:clientApp), it needs to be added using the following command:
kubectl label nodes <node_name> <nodeSelector_key_value_pair>
Once label has been attached to the node, deployment can be done successfully.