How to use the command "kube-capacity" (with examples)

How to use the command "kube-capacity" (with examples)

kube-capacity

Motivation for using this example

The kube-capacity command is used to provide an overview of resource requests, limits, and utilization in a Kubernetes cluster. By running this command, we can get a clear picture of how many resources are being used, requested, and limited across all nodes in the cluster.

Explanation for every argument

The kube-capacity command does not require any arguments. By default, it will display the total CPU and Memory resource requests and limits for each node in the cluster.

Example output

NAMESPACE   POD NAME       CPU REQUESTS   CPU LIMITS   MEMORY REQUESTS   MEMORY LIMITS
default     nginx-0        500m           1000m        128Mi             256Mi
default     nginx-1        500m           1000m        128Mi             256Mi
kube-system coredns-0       100m           300m         70Mi              170Mi
kube-system coredns-1       100m           300m         70Mi              170Mi

Capacity:
  Node             CPU REQUESTS   CPU LIMITS   MEMORY REQUESTS   MEMORY LIMITS
  node-1           1.6            2.4          3.4               4.6
  node-2           0.8            1.2          1.7               2.3
  node-3           0.6            0.9          1.2               1.7

Utilization:
  Node             CPU USAGE   MEMORY USAGE
  node-1           1.2         2.0
  node-2           0.6         1.1
  node-3           0.4         0.8

2: Using command kube-capacity -p

kube-capacity -p

Motivation for using this example

By including the -p argument, the kube-capacity command will also include information about the pods running on each node. This is helpful for getting a detailed breakdown of resource requests, limits, and utilization at the pod level.

Explanation for every argument

The -p argument is used to include information about the pods running on each node. This will add an additional section in the output that displays the resource requests and limits for each pod.

Example output

NAMESPACE   POD NAME       CPU REQUESTS   CPU LIMITS   MEMORY REQUESTS   MEMORY LIMITS
default     nginx-0        500m           1000m        128Mi             256Mi
default     nginx-1        500m           1000m        128Mi             256Mi
kube-system coredns-0       100m           300m         70Mi              170Mi
kube-system coredns-1       100m           300m         70Mi              170Mi

Capacity:
  Node             CPU REQUESTS   CPU LIMITS   MEMORY REQUESTS   MEMORY LIMITS
  node-1           1.6            2.4          3.4               4.6
  node-2           0.8            1.2          1.7               2.3
  node-3           0.6            0.9          1.2               1.7

Utilization:
  Node             CPU USAGE   MEMORY USAGE
  node-1           1.2         2.0
  node-2           0.6         1.1
  node-3           0.4         0.8

Pods:
  Node     POD NAME       CPU REQUESTS   CPU LIMITS   MEMORY REQUESTS   MEMORY LIMITS
  node-1   nginx-0        200m           500m         64Mi              128Mi
  node-1   nginx-1        200m           500m         64Mi              128Mi
  node-2   coredns-0       100m           300m         70Mi              170Mi
  node-2   coredns-1       100m           300m         70Mi              170Mi

3: Using command kube-capacity -u

kube-capacity -u

Motivation for using this example

Including the -u argument will add another section in the output that displays the utilization of CPU and Memory resources on each node. This is useful for understanding how effectively the resources are being utilized in the cluster.

Explanation for every argument

The -u argument is used to include information about the utilization of CPU and Memory resources on each node. The utilization data is based on the current usage of resources in the cluster.

Example output

NAMESPACE   POD NAME       CPU REQUESTS   CPU LIMITS   MEMORY REQUESTS   MEMORY LIMITS
default     nginx-0        500m           1000m        128Mi             256Mi
default     nginx-1        500m           1000m        128Mi             256Mi
kube-system coredns-0       100m           300m         70Mi              170Mi
kube-system coredns-1       100m           300m         70Mi              170Mi

Capacity:
  Node             CPU REQUESTS   CPU LIMITS   MEMORY REQUESTS   MEMORY LIMITS
  node-1           1.6            2.4          3.4               4.6
  node-2           0.8            1.2          1.7               2.3
  node-3           0.6            0.9          1.2               1.7

Utilization:
  Node             CPU USAGE   MEMORY USAGE
  node-1           1.2         2.0
  node-2           0.6         1.1
  node-3           0.4         0.8

Pods:
  Node     POD NAME       CPU REQUESTS   CPU LIMITS   MEMORY REQUESTS   MEMORY LIMITS
  node-1   nginx-0        200m           500m         64Mi              128Mi
  node-1   nginx-1        200m           500m         64Mi              128Mi
  node-2   coredns-0       100m           300m         70Mi              170Mi
  node-2   coredns-1       100m           300m         70Mi              170Mi

Utilization:
  Node             CPU USAGE   MEMORY USAGE
  node-1           1.2         2.0
  node-2           0.6         1.1
  node-3           0.4         0.8

Conclusion

Related Posts

How to use the command 'git clean' (with examples)

How to use the command 'git clean' (with examples)

Git clean is a command used to remove untracked files from the working tree.

Read More
How to use the command 'man' (with examples)

How to use the command 'man' (with examples)

The ‘man’ command is used to format and display the manual pages on a Linux or Unix system.

Read More
How to use the command searchsploit (with examples)

How to use the command searchsploit (with examples)

The searchsploit command is a powerful tool that allows users to search the exploit database’s database for exploits, shellcodes, and papers.

Read More