Suppose you have a Pod which needs to be running on a Pod which is having SSD in it.
First we need to add a label to the node which is having SSD
$ kubectl label node k8s-worker-01 disktype=ssd
Now we can write a Pod spec with nodeSelector
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
env: test
spec:
containers:
- name: nginx
image: nginx
nodeSelector:
disktype: ssd
Scheduler will look at the node selector and select apropriate node to run the pod
This means , we can manually specify the nodeName
in Pod
spec and schedule it.
You can read more about nodeName
in below URL
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodename