From the course: Certified Kubernetes Administrator (CKA) Cert Prep

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Managing application scheduling

Managing application scheduling

- Okay, the next task is to run a pod with the name lab167pod using the Nginx image and ensure that it only runs on nodes that have the label storage=ssd set. Okay, so how do we do that? Well, I would guess it smells like a nodes selector, right? So here also I would advise if you know that this is about NodeSelector, get back to the documentation and look it up. NodeSelector. So assigning pods to nodes, and there we have NodeSelector. And NodeSelector, oh, that is pretty simple, is field to your pod specification and specify the node labels that you want the target node to have. Well, based on that, we should get quite far. So we need a label, kubectl label node worker1 storage=ssd. And then we are going to use kubectl run lab167pod - - image=Nginx -- dry-rrn=client -o yaml > lab167pod.yaml. And then we edit 167pod.yaml. And it's a pod property, so NodeSelector where we are going to put storage: ssd. That should be doing it. Then kubectl apply -f lab167pod, and lab167pod is created…

Contents