<p>newbie here . I am trying to automate the way to get the nodes that are ready using the following script:</p>

<p><code>until kubectl get nodes | grep -m 2 "Ready"; do sleep 1 ; done</code></p>

<p>Is there a better way to do this, specifically i am looking for a way to do this without having to specify the node number?</p>

Johnny Gladwin
<p>To get the names of all <code>Ready</code> nodes, use</p>

<pre class="lang-sh prettyprint-override"><code>$ kubectl get nodes -o json | jq -r '.items[] | select(.status.conditions[].type=="Ready") | .metadata.name '

master-0
node-1
node-3
node-x
</code></pre>
