<p>I am trying to track down some bottlenecks in a GKE kubernetes cluster. I am trying to rule out resource (cpu and memory) limits. However, I am having trouble because there are resource limits set on the containers in the deployment yaml files, but there are also resource quotas set as defaults in the cluster that presumably don't apply when they are specified in the container definitions. But then I have also read that you can have pod resource limits and even limits on specific namespaces.</p>

<p>Where is the authoritative listing of what limits are being applied to a container? If I kubectl Describe the Node that has the pods, should the limits in the details be the actual limits?</p>

<p>I see you confusion, but reality is more simple.
First of all - resource requests and limits are applied on container level, not pod. Pod resources are defined as simple sum of its container resources.</p>

<ol>
<li><a href="https://kubernetes.io/docs/concepts/policy/resource-quotas/" rel="nofollow noreferrer">Namespace quotas</a>. They influence the namespace as a whole and do not influence pods themselves. The only thing namespace quota does is ensuring that sum of all pod resources in given namespace does not exceed the configured limits. If you have reasonably high namespace quota - you may forget that it even exists. But you should remember that once you define namespace quota - any single container in namespace must have resources specified. </li>
<li><a href="https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/#create-a-limitrange-and-a-pod" rel="nofollow noreferrer">LimitRange</a>. LimitRange works on namespace level. You can configure default resource requests and limits both for pods and containers. Another thing it does is specifying minimum and maximum resources for pods and containers in namespace.</li>
<li>The last but the most important is the actual pod resources. I guess this thing is more or less self-explanatory in this context.</li>
</ol>

<p>Now, when you hit "kubectl describe" on node or pod - then the <strong>actual</strong> pod requests and limits are displayed. Actual means those resources that matter. It does not matter where those resources came from - from deployment/pod spec or from LimitRange. What you see is what you get here, regardless of have you specified some quotas or LimitRange or not.</p>

<p>Does that answer your question?</p>
