题目

PS:请注意本体不在有 NoSchedule 节点,答案变成 3 个

Set configuration context $ kubectl config use-context k8s

Check to see how many nodes are ready (not including nodes tainted NoSchedule) and write the number to /opt/nodenum

答案

kubectl describe node |grep -i taints |grep -v -i noschedule
echo $Num > /opt/KUSC00402/kusc00402.txt

或者:

# for i in `kubectl get nodes|grep Ready|grep -v 'NAME'|awk '{print $1}'` ;
do 
    kubectl describe node $i |grep Taints|grep -v 'NoSchedule';
done|wc -l >/opt/nodenum

# cat /opt/nodenum

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐