<p>I'm trying to use Kubectl get namespaces command it is fetching the data.</p>
<pre><code>kubectl get namespace
NAME              STATUS   AGE
default           Active   1d
kube-node-lease   Active   1d
kube-public       Active   1d
kube-system       Active   1d
</code></pre>
<p>but I want to filter it with name only. So when u run the script it should show like this.</p>
<pre><code>kubectl get namespace
NAME              
default           
kube-node-lease  
kube-public       
kube-system    
</code></pre>
<p>I've tried some powershell command but it is not working out for me.</p>

<p>Try any one of the command</p>
<pre><code>kubectl get namespace --template '{{range .items}}{{.metadata.name}}{{&quot;\n&quot;}}{{end}}'
</code></pre>
<pre><code>kubectl get namespace | awk '{print $1}'
</code></pre>
<pre><code>kubectl get namespace --no-headers -o custom-columns=&quot;:metadata.name&quot;
</code></pre>
<pre><code>kubectl get namespace -o=name |  sed &quot;s/^.\{10\}//&quot;
</code></pre>
