Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 874
Kowshhal Avatar asked Oct 26 '25 09:10

Kowshhal


1 Answers

-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"}
like image 88
confused genius Avatar answered Oct 28 '25 04:10

confused genius



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!