To identify CPU limits for customer workloads experiencing throttling in a TKGm environment, utilize this command.
2.x, 3.x
Command:
kubectl get pods -A -o jsonpath="{range .items[*]}[{.metadata.namespace}/{.metadata.name}, {.spec.containers[*].resources.limits.cpu}]{'\n'}{end}"
Explanation:
-A: Lists resources across all namespaces.
-o jsonpath: Outputs specific fields using JSONPath.
{range .items[*]}: Iterates over all pods.
[{.metadata.namespace}/{.metadata.name}: Prints the namespace and pod name.
, {.spec.containers[*].resources.limits.cpu}]: Displays the CPU limits for all containers within the pod.
{'\n'}: Adds a newline for each pod.
{end}: Ends the range loop.
Sample output:
default/nginx-deployment-5c689d85b8-zsk8z, 500m 1
kube-system/coredns-64897985d-qbdvl, 100m
Here:
default/nginx-deployment-5c689d85b8-zsk8z: Namespace and pod name.
500m 1: CPU limits for containers in the pod (in millicores).