1. Switch to respective context
kubectl config use-context k8s
2. Create the yaml
kubectl run nginx-kusc00401 --image nginx --dry-run=client -oaml > q21.yaml
3. Edit the yaml
vi q21.yaml
4. Just add following line below dnsPolicy. Make sure align with it
...
dnsPolicy: ClusterFirst
nodeSelector:
disk: spinning #make sure to indented below nodeSelector
---
5. kubectl apply -f q21.yaml
6. kubectl get pods -o wide
here is the answer, but you can also add labels on metadata
apiVersion: v1
kind: Pod
metadata:
name: nginx-kusc00401
spec:
containers:
- name: nginx-kusc00401
image: nginx
nodeSelector:
disk: spinning
Why do you need to label a node? How do you know which node to label? I think the label already exists, and all you need to do is create a pod with a node selector referring to this label.
upvoted 2 times
...
...
...
...
This section is not available anymore. Please use the main Exam Page.CKA Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Jasonwcc
5 days, 14 hours ago2211094
8 months, 2 weeks agofc146fc
1 year, 4 months agoabu7midan
1 year, 7 months agoskywalker
1 year, 7 months agotestingspeedz214
9 months, 3 weeks agoStargazer11
1 year, 5 months agoNasser_Sam
7 months, 1 week ago