killer_sh_lab:
k get no
k describe no node01 | g taint
# keep it simple, check each node, there’s only a few nodes.
# count number of nodes accordingly not including nodes tainted NoSchedule, sample below:
echo “2” > /opt/KUSC00402/kusc00402.txt
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 2 years, 1 month agoleebug
1 year, 6 months agofrankja2
Highly Voted 1 year, 2 months agonoahsark
Most Recent 1 month, 3 weeks ago137eceb
2 months, 1 week agoArchanakaviya
2 months, 3 weeks ago[Removed]
5 months, 1 week agozanhsieh
8 months agoplamennfs
8 months, 4 weeks agowwwmmm
4 months agothanhnv142
9 months, 2 weeks agofc146fc
10 months, 2 weeks agoEinthu
1 year, 3 months agofemijohn123
1 year, 3 months agoSamm1
1 year, 4 months agoShenannigan
1 year, 4 months agoShenannigan
1 year, 4 months agoShepardos
1 year, 4 months agomellohello
1 year, 6 months agomellohello
1 year, 6 months ago