<p>I am trying to fetch the actual and total amount of memory allocated to a pod using API.
While I am able to fetch actual memory consumption using metrics server api.
How can I fetch total memory assigned to pod using metrics server API?</p>
<p>I am developing a dashboard in which I need to showcase pod memory and cpu.The ui graph has input actual and total amout. I can fetch actual memory used by command kubectl get --raw /apis/metrics.k8s.io/v1beta1/namespaces/default/pods/ but how can I get total memory of pod?</p>

Peter
<p>All the available APIs are described at <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19" rel="nofollow noreferrer">Kubernetes API Guide</a>. It is available for  the different K8s versions (just pay attention to URL).</p>
<blockquote>
<p>Nick, How can I fetch this value using API ?</p>
</blockquote>
<p>At a first glance even  <code>/api/v1/namespaces/&lt;namespace&gt;/pods/</code> will do the job.</p>
<p>Please see my example (I have decided to tet it myself).</p>
<pre><code>$ cat pod.yaml 

apiVersion: v1
kind: Pod
metadata:
  name: server-go-lim 
  ...
spec:
  containers:
  - image: nkolchenko/enea:server_go_latest
    resources:
      ...
      limits:
        memory: 1024Mi   # Here is the Limit
    ...

$ kubectl create -f pod.yaml
pod/server-go-lim created


$ kubectl get --raw /api/v1/namespaces/default/pods/server-go-lim | json_pp 
{
   ...
   &quot;spec&quot; : {
      &quot;containers&quot; : [
         {
            &quot;resources&quot; :  
               &quot;limits&quot; : {
                  &quot;memory&quot; : &quot;1Gi&quot;
               }

</code></pre>
<p>As we can see, API returns Limits for pod.
Let me know if that's the one you've been looking for.</p>
