Kowshhal
Kowshhal

Reputation: 291

Check Limits and requests for a pod with kubectl

can anyone help me with the command to view limits and requests of a pod or containers in a pod? I have tried Kubectl describe pod , kubectl get pod --output=yaml , kubectl describe node - shows the current limits but not the configured limits. I want to see the configured limits and requests in the yaml.

Thanks.

Upvotes: 4

Views: 9374

Answers (1)

confused genius
confused genius

Reputation: 3244

-Try following command :

kubectl get pods <podname> -o jsonpath='{range .spec.containers[*]}{"Container Name: "}{.name}{"\n"}{"Requests:"}{.resources.requests}{"\n"}{"Limits:"}{.resources.limits}{"\n"}{end}'
Example:
kubectl get pods frontend -o jsonpath='{range .spec.containers[*]}{"Container Name: "}{.name}{"\n"}{"Requests:"}{.resources.requests}{"\n"}{"Limits:"}{.resources.limits}{"\n"}{end}'
Container Name: app
Requests:{"cpu":"250m","memory":"64Mi"}
Limits:{"cpu":"500m","memory":"128Mi"}
Container Name: log-aggregator
Requests:{"cpu":"250m","memory":"64Mi"}
Limits:{"cpu":"500m","memory":"128Mi"}

Upvotes: 10

Related Questions