exam questions

Exam CKA All Questions

View all questions & answers for the CKA exam

Exam CKA topic 1 question 8 discussion

Actual exam question from CNCF's CKA
Question #: 8
Topic #: 1
[All CKA Questions]

SIMULATION -


Task -
Schedule a pod as follows:
✑ Name: nginx-kusc00401
✑ Image: nginx
✑ Node selector: disk=ssd

Show Suggested Answer Hide Answer
Suggested Answer:






Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
k8s_psg
Highly Voted 1 year, 5 months ago
@pentium2000 it's not disk=ssd, it should be disk: ssd
upvoted 13 times
...
pentium2000
Highly Voted 1 year, 6 months ago
https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/ apiVersion: v1 kind: Pod metadata: name: nginx-kusc00401 spec: containers: - name: nginx-kusc00401 image: nginx nodeSelector: disk=ssd
upvoted 6 times
ScrewOnPrem
1 year, 4 months ago
nodeSelector: disktype: ssd https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes/ In above url itself it is clearly mentioned.
upvoted 5 times
...
...
siriseniaws
Most Recent 5 months ago
Hers first we have to do the node label. kubectl label no node02 disk=ssd then execute below code root@master:~# cat nodeSelector.yml apiVersion: v1 kind: Pod metadata: labels: run: nginx-kusc00401 name: nginx-kusc00401 spec: containers: - image: nginx name: nginx nodeSelector: disk: ssd root@master:~# then only pod will be in running state. root@master:~# kubectl get po -o wide | grep 401 nginx-kusc00401 1/1 Running 0 7m52s 10.0.2.128 node02 <none> <none> root@master:~#
upvoted 2 times
...
cp2323
6 months, 4 weeks ago
first label the node or check if the label exist on the node kubectl get nodes --show-labels | grep -i disk=ssd if NOT exist then run - kubectl label node node01 disk=ssd then apiVersion: v1 kind: Pod metadata: name: nginx-kusc00401 spec: containers: - name: nginx image: nginx imagePullPolicy: IfNotPresent nodeSelector: disk: ssd
upvoted 2 times
...
LavaPup
8 months ago
For some reason, the code provided by Pentium or ScrewOnPrem didn;t work for me until I added the labels under metadata
upvoted 1 times
...
bp339
12 months ago
apiVersion: v1 kind: Pod metadata: name: nginx-kusc00401 spec: containers: - name: nginx image: nginx imagePullPolicy: IfNotPresent nodeSelector: disk: ssd this works for me
upvoted 1 times
...
kopper2019
1 year, 1 month ago
root@cka-master1:~ # kubectl label nodes cka-node1 disk=spinning root@cka-master1:~ # kubectl get nodes --show-labels root@cka-master1:~ # vim nodeselector.yaml apiVersion: v1 kind: Pod metadata: name: nginx-kusc00401 spec: containers: - name: nginx image: nginx imagePullPolicy: IfNotPresent nodeSelector: disk: spinning # root@cka-master1:~ # kubectl apply -f nodeselector.yaml
upvoted 2 times
...
dkjwr
1 year, 2 months ago
The "nodeselector" arguement is looking a a label on the node. Use- kubectl get nodes --show-labels to check what that label actually is. The examples using "disktype" from the docs are using that because that is the label name that has been attached to the node. P.S. It's a ":" not a "=" -> disk: ssd
upvoted 4 times
...
junaid84u
1 year, 5 months ago
nodeSelector is the good and right path .. please don;t use nodeaffinity as its different
upvoted 2 times
...
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.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago