You can obtain vCPU capacity from a Tanzu Application Platform environment either manually or by running a Bash script.
KUBECONFIG
environment variable to the path to the kubeconf
file for the Tanzu Application Platform cluster.Obtain either formatted or raw vCPU information from the cluster.
To obtain formatted output, run the following command:
echo "vCPU capacity: $(kubectl get -A nodes -o json | jq '[.items[].status.capacity.cpu | tonumber] | add')"
To obtain raw output, run the following command:
kubectl get -A nodes -o json | jq '[.items[].status.capacity.cpu | tonumber] | add'
NOTE: The output will be the total vCPU capacity of that cluster.
KUBECONFIG
environment variable to the path to the kubeconf
file for the Tanzu Application Platform Management cluster.get_cpu_script.sh
.Give the file permission to run.
chmod +x /path/to/file/get_cpu_single_cluster_script.sh
Run the script.
/path/to/file/get_cpu_single_cluster_script.sh
Copy this script into a text file when you run the Bash Script Collection procedure.
#!/bin/bash
printf "\nCollection Timestamp:\t%s\n" "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
printf "Total TAP vCPUs:\t%s\n\n" "$(kubectl get -A nodes -o json | jq '[.items[].status.capacity.cpu | tonumber] | add')"
When you run the script, you see the following output.
Collection Timestamp: 2022-01-24T18:45:11Z
Total TKG vCPUs: 20