<p>What is the <code>kubernetes</code> <code>cli</code> command that will list all nodes with state &quot;Ready&quot; except master node(s) ?</p>

<p><strong>Answer:</strong></p>
<pre><code>$ kubectl get nodes --selector '!node-role.kubernetes.io/master' --output jsonpath=&quot;{.items[?(@.status.conditions[-1].type=='Ready')].status.conditions[-1].type}&quot;
</code></pre>
<p><strong>Explenation:</strong></p>
<p>Selector flag <code>--selector '!node-role.kubernetes.io/master'</code> excludes all nodes that does not match <code>node-role.kubernetes.io/master</code> label.</p>
<p>Output flag <code>--output jsonpath=&quot;{.items[?(@.status.conditions[-1].type=='Ready')].status.conditions[-1].type}&quot;</code> matches nodes, which last conditions is in Ready state - this turns out to be status of KubeletReady.</p>
<p><strong>Edit:</strong> More elegant solution</p>
<pre><code>$ kubectl get nodes --selector '!node-role.kubernetes.io/master' --output jsonpath=&quot;{range .items[?(@.status.conditions[-1].type=='Ready')]}{.metadata.name} {.status.conditions[-1].type}{'\n'}{end}&quot;
</code></pre>
