Node Labels and Selectors

Node labels:-  You can constrain a pod to run only on a particular node. To do this use label selectors to make the selection.

          kubectl label nodes <node-name> <label-key>=<label-value>

Node Selector:-

  • NodeSelector is the simplest form of node selection constraint.
  • NodeSelector is a field of Pod specification. It specifies a map of key-value pairs.

Task by trainer:-

Create a nginx-selector.yml file in /root directory to deploy a pod on node 1

Node1 label =  disktype=ssd,  Pod name =  nginxselector,  image =   nginx