<p>So, i am trying to pull a list of all internal pods ports from all namespaces and i have the following command which is working but just for a specific pod/namespace/rc.</p>
<pre><code>PS C:\Users\&gt; kubectl get -o jsonpath=&quot;{.spec.template.spec.containers[*]['ports','name']}&quot; deployments rke2-coredns-rke2-coredns -n kube-system
[{&quot;containerPort&quot;:53,&quot;name&quot;:&quot;udp-53&quot;,&quot;protocol&quot;:&quot;UDP&quot;},{&quot;containerPort&quot;:53,&quot;name&quot;:&quot;tcp-53&quot;,&quot;protocol&quot;:&quot;TCP&quot;}] coredns
</code></pre>
<p>How can make the command work for all pods in deployments?</p>
<p>Thanks,
EM</p>

Manx123
<p>Use can use the <code>--all-namespaces</code> parameter (or <code>-A</code>) :</p>
<pre class="lang-bash prettyprint-override"><code>kubectl get -o jsonpath=&quot;{.spec.template.spec.containers[*]['ports','name']}&quot; deployments --all-namespaces
</code></pre>
<p>If you want to retrieve a specific <code>deployment</code> this will not work as a resource cannot be retrieved by name across all namespaces.</p>
