<p>I'd like to (programatically) get a list of all schedulable nodes in my kubernetes cluster.</p>

<p>I'm fairly sure this used to be possible by looking at <code>.spec.unschedulable</code> in the full output of <code>kubectl get nodes</code> (using JSON or template output), but now it seems this info is inside the  <code>scheduler.alpha.kubernetes.io/taints</code> key, which is much harder to parse and just doesn't feel like the right place.</p>

<p>Is there some other way to find this info? Am I missing something obvious? I'm using version 1.5.1 currently.</p>

<p>UPDATE: I can <em>almost</em> get there with some Go templating:</p>

<pre><code>$ kubectl get nodes -o go-template='{{range .items}}{{with $x := index .metadata.annotations "scheduler.alpha.kubernetes.io/taints"}}{{.}}{{end}}{{end}}'
[{"key":"dedicated","value":"master","effect":"NoSchedule"}]
</code></pre>

<p>But that leaves me with a blob of JSON that I can't parse in the template, and I still have to invert the results and get the node name out.</p>

<p>UPDATE 2: Apparently unschedulable nodes should have <code>.spec.unschedulable</code> set. This doesn't seem to always be the case; not sure if it's due to a bug or a misunderstanding on my part.</p>

<p>Though quite late to the party, I needed something of the similar today to determine when the scheduling of pods would actually start succeeding:</p>

<pre><code>kubectl get nodes -o jsonpath="{range .items[*]}{.metadata.name} {.spec.taints[?(@.effect=='NoSchedule')].effect}{\"\n\"}{end}" | awk 'NF==1 {print $0}'
</code></pre>

<p><s>this is essentially just a more compact template than the one the OP posted with the inversion done by filterung with <code>awk</code>.</s></p>

<p><em>Edit:</em> after trying to use the command I had posted earlier, I realized that it would only work in the edge case of a single master. Thus I have extended the command to first print all node names along with <code>NoSchedule</code> taints (if present) and afterwards removing all lines with more than one column using <code>awk</code> (This is what <code>NF==1</code> does).</p>
