Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam CKA topic 1 question 9 discussion

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

SIMULATION -


Task -
Check to see how many nodes are ready (not including nodes tainted NoSchedule) and write the number to /opt/KUSC00402/kusc00402.txt.

Show Suggested Answer Hide Answer
Suggested Answer:

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
SijoTharakan
Highly Voted 1 year, 9 months ago
kubectl get nodes -o=custom-columns=NodeName:.metadata.name,TaintKey:.spec.taints[*].key,TaintValue:.spec.taints[*].value,TaintEffect:.spec.taints[*].effect Reference: https://kubernetes.io/docs/reference/kubectl/cheatsheet/#interacting-with-nodes-and-cluster
upvoted 19 times
leebug
1 year, 1 month ago
Thanks for the link to the reference!
upvoted 3 times
...
...
frankja2
Highly Voted 9 months, 4 weeks ago
are you drunk or on drugs? It says "NOT INCLUDING" but every answer is like getting those
upvoted 6 times
...
learndigitalcloud
Most Recent 6 days, 17 hours ago
kubectl get nodes --no-headers | grep -v 'NoSchedule' | grep -c ' Ready ' > /opt/KUSC00402/kusc00402.txt
upvoted 1 times
...
zanhsieh
3 months ago
k8s jsonpath doesn't support multiple filter conditions like: ...conditions[?(@.type=="Ready" && @.status=="True")].type ...conditions[?(@.type=="Ready" AND @.status=="True")].type So have to play around with extra grep as below. This shall handle node status Ready. k get no --no-headers -o='custom-columns=NodeName:.metadata.name,TaintKey:.spec.taints[*].key,TaintValue:.spec.taints[*].value,TaintEffect:.spec.taints[*].effect,Status:.status.conditions[?(@.type=="Ready")].status' | grep -v NoSchedule | grep True > /opt/KUSC00402/kusc00402.txt
upvoted 1 times
...
plamennfs
3 months, 4 weeks ago
The easiest solution and smart solution is : k describe nodes | grep -i taint | grep none -c > /opt/KUSC00402/kusc00402.txt
upvoted 1 times
...
thanhnv142
4 months, 2 weeks ago
step 1: kubectl get nodes - o yaml | grep taint step 2: check the tainted and export to the file
upvoted 2 times
...
fc146fc
5 months, 2 weeks ago
kubectl get nodes –no-headers -o='custom-columns=NodeName:.metadata.name,TaintKey:.spec.taints[*].key,TaintValue:.spec.taints[*].value,TaintEffect:.spec.taints[*].effect' | grep -v NoSchedule | wc -l > /opt/KUSC00402/kusc00402.txt
upvoted 2 times
...
Einthu
10 months ago
k get nodes -o jsonpath='{range.items[*]}{.metadata.name}{"\t"}{.spec.taints[?(.effect == "NoSchedule")]}{"\n"}{end}'
upvoted 2 times
...
femijohn123
10 months, 3 weeks ago
k get nodes -o yaml --no-headers | grep -i taint | wc -l #this will show the tainted nodes
upvoted 1 times
...
Samm1
11 months, 1 week ago
From my understanding of the question: -c command will count the occurrence, for example of 2 node with 1 tainted node kubectl get nodes -o=custom-columns=NodeName:.metadata.name,TaintKey:.spec.taints[*].key,TaintValue:.spec.taints[*].value,TaintEffect:.spec.taints[*].effect| grep -c NoSchedule > to1.txt cat to1.txt. # 1
upvoted 2 times
...
Shenannigan
11 months, 2 weeks ago
I was able to accomplish this with the following command: k get nodes --no-headers -o custom-columns=Name:.metadata.name,Taint:.spec.taints[*].effect,Ready:'{.status.conditions[?(@.reason == "KubeletReady")].status}' | grep -v NoSchedule | wc -l you can remove the | wc -l to see the output
upvoted 1 times
Shenannigan
11 months, 2 weeks ago
modified to pull type instead of True/False value so you get the ready output k get nodes --no-headers -o custom-columns=Name:.metadata.name,Taint:.spec.taints[*].effect,Ready:'{.status.conditions[?(@.reason == "KubeletReady")].type}' | grep -v NoSchedule
upvoted 1 times
...
...
Shepardos
11 months, 2 weeks ago
kubectl describe node | grep -ie Ready -ie taint
upvoted 2 times
...
mellohello
1 year, 1 month ago
controlplane $ vim /opt/KUSC00402/kusc00402.txt write the number of the nodes, then save the doc! controlplane $ cat /opt/KUSC00402/kusc00402.txt
upvoted 2 times
...
mellohello
1 year, 1 month ago
kubectl describe node | grep -i taint > /opt/KUSC00402/kusc00402.txt
upvoted 1 times
...
kopper2019
1 year, 3 months ago
kubectl describe nodes | grep "Taint" | grep "NoSchedule" | wc -1
upvoted 2 times
kopper2019
1 year, 3 months ago
sorry -l kubectl describe nodes | grep "Taint" | grep "NoSchedule" | wc -l
upvoted 1 times
kolinsteroy
11 months, 3 weeks ago
It says "not including"
upvoted 1 times
...
...
...
DALLO
1 year, 4 months ago
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}' \ && kubectl get nodes -o jsonpath="$JSONPATH" | grep "Ready=True"
upvoted 1 times
DALLO
1 year, 4 months ago
https://kubernetes.io/docs/reference/kubectl/cheatsheet/#interacting-with-deployments-and-services , in the page filter "ready"
upvoted 1 times
...
DALLO
1 year, 4 months ago
well , be careful, they need nodes with ready state and ( (not including nodes tainted NoSchedule)), two conditions , my answer is not right!
upvoted 1 times
...
...
hjson821109
1 year, 4 months ago
kubectl describe node | grep -i taint
upvoted 3 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 ...
ex Want to SAVE BIG on Certification Exam Prep?
close
ex Unlock All Exams with ExamTopics Pro 75% Off
  • arrow Choose From 1000+ Exams
  • arrow Access to 10 Exams per Month
  • arrow PDF Format Available
  • arrow Inline Discussions
  • arrow No Captcha/Robot Checks
Limited Time Offer
Ends in