I am trying to get the maximum capacity of pod per node. I am running kubectl describe node nodename
and trying to grep the pods limit in capacity section. Any help would be appreciated. The output is like this.
Capacity:
attachable-volumes-azure-disk: 8
cpu: 4
ephemeral-storage: 129900528Ki
hugepages-1Gi: 0
hugepages-2Mi: 0
memory: 16393308Ki
pods: 110
CodePudding user response:
if you want to use just native ooptions of kubectl command
kubectl get nodes <nodename> -o jsonpath='{.status.capacity.pods}{"\n"}'
If you dont need trailing newline character after the output:
kubectl get nodes <nodename> -o jsonpath='{.status.capacity.pods}'
CodePudding user response:
try the below command
kubectl describe no node01 | sed -n '/Capacity/,/pods/p' | grep -i pods | awk '{print $2}'