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, 4 months agonaggar_30
1 month, 2 weeks agoleebug
1 year, 8 months agofrankja2
Highly Voted 1 year, 4 months agojesmonsa
Most Recent 1 month agonoahsark
3 months, 4 weeks ago137eceb
4 months, 1 week agoArchanakaviya
4 months, 3 weeks ago[Removed]
7 months, 1 week agozanhsieh
10 months agoplamennfs
11 months agowwwmmm
6 months, 1 week agothanhnv142
11 months, 3 weeks agofc146fc
1 year agoEinthu
1 year, 5 months agofemijohn123
1 year, 5 months agoSamm1
1 year, 6 months agoShenannigan
1 year, 6 months agoShenannigan
1 year, 6 months agoShepardos
1 year, 6 months agomellohello
1 year, 8 months ago