<p>I am developing an application in python where i need to consume the current values of a metric for some pods(eg. cpu, memory). I can get this info through an API (/apis/metrics.k8s.io/v1beta1/pods) but i try to use the kubernetes client so as to access these metrics within my python app.</p>
<p>I see that the <a href="https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V2beta2PodsMetricStatus.md" rel="nofollow noreferrer">V2beta2PodsMetricStatus</a> Model includes the information i need but i can not find the <a href="https://github.com/kubernetes-client/python/tree/master/kubernetes#documentation-for-api-endpoints" rel="nofollow noreferrer">API endpoint</a> i should use so as to reach this model.</p>
<p>Any help or alternative option would be very helpful since i am really stacked with this issue several days.</p>
<p>Thank you very much for you time.</p>

efotopoulou
<p>I finally get the metrics by executing directly the relevant kubectl command. I do not like the solution but it works. Hope to be able to use the kubernetes-client instead at the near future.</p>
<pre><code>import subprocess
p = subprocess.getoutput('kubectl get --raw /apis/metrics.k8s.io/v1beta1/namespaces/default/pods')
ret_metrics = json.loads(p)
items = ret_metrics['items']
 for item in items:
   print(item['metadata']['name'])
</code></pre>
