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, 5 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 18 times
leebug
10 months, 2 weeks ago
Thanks for the link to the reference!
upvoted 2 times
...
...
frankja2
Highly Voted 6 months, 3 weeks ago
are you drunk or on drugs? It says "NOT INCLUDING" but every answer is like getting those
upvoted 6 times
...
plamennfs
Most Recent 3 weeks, 2 days 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
1 month, 2 weeks ago
step 1: kubectl get nodes - o yaml | grep taint step 2: check the tainted and export to the file
upvoted 1 times
...
fc146fc
2 months, 1 week 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 1 times
...
Einthu
7 months ago
k get nodes -o jsonpath='{range.items[*]}{.metadata.name}{"\t"}{.spec.taints[?(.effect == "NoSchedule")]}{"\n"}{end}'
upvoted 2 times
...
femijohn123
7 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
8 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
8 months, 1 week 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
8 months, 1 week 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
8 months, 2 weeks ago
kubectl describe node | grep -ie Ready -ie taint
upvoted 2 times
...
mellohello
10 months, 3 weeks 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
10 months, 3 weeks ago
kubectl describe node | grep -i taint > /opt/KUSC00402/kusc00402.txt
upvoted 1 times
...
kopper2019
12 months ago
kubectl describe nodes | grep "Taint" | grep "NoSchedule" | wc -1
upvoted 2 times
kopper2019
12 months ago
sorry -l kubectl describe nodes | grep "Taint" | grep "NoSchedule" | wc -l
upvoted 1 times
kolinsteroy
8 months, 2 weeks ago
It says "not including"
upvoted 1 times
...
...
...
DALLO
1 year 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 ago
https://kubernetes.io/docs/reference/kubectl/cheatsheet/#interacting-with-deployments-and-services , in the page filter "ready"
upvoted 1 times
...
DALLO
1 year 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, 1 month ago
kubectl describe node | grep -i taint
upvoted 3 times
...
hjson821109
1 year, 1 month ago
kubectl get node | grep -i taint
upvoted 1 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 ...