Kubernetes CKA sample exam question 37 with answer

Question
Schedule a pod as follows:
Name: nginx-ssd
Image: nginx
Node selector: disk=ssd

Answer
Inspect nodes setup:

kubectl get nodes --show-labels
Generate a pod manifest:
kubectl run nginx-ssd --image=nginx --dry-run=client -o yaml
Adjust manifest:
apiVersion: v1
kind: Pod
metadata:
  labels:
    run: nginx-ssd
  name: nginx-ssd
spec:
  containers:
  - image: nginx
    name: nginx-ssd
  nodeSelector:
    disk: ssd
Apply and check:
kubectl apply -f po.yaml
kubectl get po -o wide
The pod should be scheduled on the node with the label disk=ssd