<p>Is there a way query cpu request and limit with kubectl for each container in a kubernetes context / namespace, just as I can query cpu usage with kubectl top pods.</p>

morfys
<p><a href="https://kubernetes.io/docs/reference/kubectl/jsonpath/" rel="nofollow noreferrer">Requests and limits</a> are the mechanisms Kubernetes uses to control resources such as CPU and memory. Requests are what the container is guaranteed to get. If a container requests a resource, Kubernetes will only schedule it on a node that can give it that resource. Limits, on the other hand, make sure a container never goes above a certain value. The container is only allowed to go up to the limit, and then it is restricted.Limit can never be lower than the request.</p>
<p>As said by @chris, try the following commands for cpu requests and limits for kubernetes namespaces</p>
<p>You can get the pods and their CPU requests with the following command.</p>
<pre><code>kubectl get pods --all-namespaces  -o=jsonpath=&quot;{range .items[*]}{.metadata.namespace}:{.metadata.name}{'\n'}{range .spec.containers[*]} {.name}:{.resources.requests.cpu}{'\n'}{end}{'\n'}{end}&quot; 
</code></pre>
<p>You can get the pods and their CPU  Limits with the following command.</p>
<pre><code>kubectl get pods --all-namespaces  -o=jsonpath=&quot;{range .items[*]}{.metadata.namespace}:{.metadata.name}{'\n'}{range .spec.containers[*]} {.name}:{.resources.limits.cpu}{'\n'}{end}{'\n'}{end}&quot;
</code></pre>
