Edith Puclla:
I have a doubt in this question:
Create a pod that will be deployed to a Node that has the label 'accelerator=nvidia-tesla-p100.
My command is this:
k run pod --image=nginx --restart=Never --labels=accelerator=nvidia-tesla-p100
I saw this other answer:
kubectl label nodes <your-node-name> accelerator=nvidia-tesla-p100
Which of them is the right answer?
Kiran Kumar R:
kubectl label nodes <your-node-name> accelerator=nvidia-tesla-p100
This is the command for labeling the node .
Edith Puclla:
It means that the node already exits, right?
Kiran Kumar R:
k run pod --image=nginx --restart=Never --labels=accelerator=nvidia-tesla-p100
This the command for deploying pod with label accelerator=nvidia-tesla-p100
Kiran Kumar R:
That you can check by using this kubectl get node --show-labels .
Edith Puclla:
I got it:
edith@edithcp:~/training/K8s-for-developers/tips/practice_tdl$ k get node -L accelerator
NAME STATUS ROLES AGE VERSION ACCELERATOR
minikube Ready control-plane,master 121d v1.20.2 nvidia-tesla-p100
Edith Puclla:
I labeled minikube node. Thank you!!
chris resnik:
just to make it clear:
> k run pod --image=nginx --restart=Never --labels=accelerator=nvidia-tesla-p100
> This the command for deploying pod with label accelerator=nvidia-tesla-p100
this does not assign a pod to a particular node
this only labels a pod
Kiran Kumar R:
Edith If you want to deploy pod in particular node , then use node selector .
Edith Puclla:
Yes, that command, just create the pod with a label.
Edith Puclla:
=> pod in label A and then node in label A, is not enough that? @Kiran Kumar R
I am checking
chris resnik:
no, not enough
chris resnik:
labels are just something like tags
chris resnik:
node selector is the counterpart
Edith Puclla:
okie…I will check it