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.
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
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
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
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
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.
SijoTharakan
Highly Voted 1 year, 6 months agoleebug
11 months agofrankja2
Highly Voted 7 months, 1 week agozanhsieh
Most Recent 1 week, 4 days agoplamennfs
1 month, 1 week agothanhnv142
1 month, 4 weeks agofc146fc
2 months, 3 weeks agoEinthu
7 months, 2 weeks agofemijohn123
8 months agoSamm1
8 months, 3 weeks agoShenannigan
8 months, 3 weeks agoShenannigan
8 months, 3 weeks agoShepardos
9 months agomellohello
11 months, 1 week agomellohello
11 months, 1 week agokopper2019
1 year agokopper2019
1 year agokolinsteroy
9 months agoDALLO
1 year, 1 month agoDALLO
1 year, 1 month agoDALLO
1 year, 1 month agohjson821109
1 year, 2 months agohjson821109
1 year, 2 months ago