cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Abhi.Bajaj
AppDynamics Team

How do you get Cluster Capacity (pods)?

In the image below we see Cluster Capacity is being met.

image001 (3).png

How can I get ClusterCapacity?

  • Use the command just below
kubectl get nodes -o jsonpath='{.items[*].status.capacity.pods}' | tr -s ' ' '\n' | a

How it works

1. Check the Maximum Pods per Node

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.

2. Count the Number of Nodes

Next, count the total number of nodes in your cluster:

kubectl get nodes --no-headers | wc -l

3. Calculate Total Pod Capacity

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.

Screenshot 2024-04-16 at 7.54.50 PM.png

Screenshot 2024-04-16 at 7.54.21 PM.png

  

Version history
Last update:
‎05-07-2024 09:18 AM
Updated by: