<p>i have a code to get the number of Pods it give the output but it loads too many unwanted data in (ret_pod), is there a better way to do it?</p>
<pre><code>from  kubernetes import client , config 

config.load_kube_config()
v1= client.CoreV1Api()
ret_pod = v1.list_pod_for_all_namespaces(watch=False)
print(len(ret_pod.items))
</code></pre>
<p>which gives me the output of</p>
<pre><code>kubectl get po -A -o json 
</code></pre>
<p>and then finds the length. but i just want to do the output of</p>
<pre><code>kubectl get po -A
</code></pre>

<p>In kubectl way:</p>
<pre><code>kubectl get po -A --no-headers | wc -l
</code></pre>
