<p>I want to be loop through the node names from the
<code>kubectl get nodes</code> command and echo the names in <code>Bash</code>.</p>

Clement Okyere
<p><code>kubectl</code> provides various filters under <code>-o</code> flag. you can see the list using <code>kubectl --help</code>.  One of the ways is to loop over it using for loop.</p>
<pre><code>for node in $(kubectl get nodes -o name);
do
  echo &quot;     Node Name: ${node##*/}&quot;
  echo &quot;Type/Node Name: ${node}&quot;
  echo  
done
</code></pre>
<blockquote>
<p>-o, --output='': Output format. One of:
json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...</p>
</blockquote>
