<p>i have linux command to get the resource usage of the pods in particular namespace what is the equivalent python command for it</p>
<pre><code>$ kubectl top pod
NAME                                CPU(cores)   MEMORY(bytes)   
nginx-deployment-7fd6966748-57mt5   0m           2Mi             
nginx-deployment-7fd6966748-jpbjl   0m           2Mi             
nginx-deployment-7fd6966748-snrx4   0m           2Mi
</code></pre>

<p>Thanks for the input the following command worked fine</p>
<pre><code>&gt;&gt;&gt; from kubernetes import client, config
&gt;&gt;&gt; 
&gt;&gt;&gt; config.load_kube_config()
&gt;&gt;&gt; api = client.CustomObjectsApi()
&gt;&gt;&gt; resource = api.list_namespaced_custom_object(group=&quot;metrics.k8s.io&quot;,version=&quot;v1beta1&quot;, namespace=&quot;default&quot;, plural=&quot;pods&quot;)
&gt;&gt;&gt; for pod in resource[&quot;items&quot;]:
...    print(pod['containers'], &quot;\n&quot;)
...
</code></pre>
