In the image below we see Cluster Capacity is being met.
kubectl get nodes -o jsonpath='{.items[*].status.capacity.pods}' | tr -s ' ' '\n' | a
First, you need to determine the maximum number of pods that each node can support. This can typically be found in the node’s capacity information:
kubectl get nodes -o jsonpath='{.items[*].status.capacity.pods}'
This command will print the maximum number of pods for each node in your cluster.
Next, count the total number of nodes in your cluster:
kubectl get nodes --no-headers | wc -l
You can then multiply the average (or minimum if there is a large disparity) maximum pods per node by the total number of nodes to get an estimate of the total pod capacity of the cluster.
If you want a single command to fetch the total pod capacity based on the current node configurations and assuming uniform configuration across nodes, you could use the following command chain:
kubectl get nodes -o jsonpath='{.items[*].status.capacity.pods}' | tr -s ' ' '\n' | a
In this case,
abhibaj@ABHIBAJ-M-2KXL KubernetesInstallation % kubectl get nodes -o jsonpath='{.items[*].status.capacity.pods}' | tr -s ' ' '\n' | awk '{sum += $1} END {print sum}'
116
The same can be seen on the ClusterAgent page.