<p>I want to get the list of the nodes and their status in Kubernetes via the go client. I am using
<code>clientset.CoreV1().Nodes().List(metav1.ListOptions{})</code>
and I am able to get the list of nodes and some information such as node lables but I cannot find the <code>status.phase</code> there (for pods that give me the status).</p>
<p>I searched and I found <code>NodeCondition</code> (<a href="https://github.com/kubernetes/api/blob/9b64426eca51a74faa7cc9bd732a533d339c69c2/core/v1/types.go#L4911" rel="nofollow noreferrer">https://github.com/kubernetes/api/blob/9b64426eca51a74faa7cc9bd732a533d339c69c2/core/v1/types.go#L4911</a>) but I cannot find any documentation regarding how to use it and I couldn't make it work myself. Can someone please let me know how I can get the status of Nodes via the client?</p>

AVarf
<p>You can access it through <code>node.Status.Condition</code></p>
<pre><code>nodes, _ := client.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})

for _, node := range nodes.Items {
    fmt.Printf(&quot;%s\n&quot;, node.Name)
    for _, condition := range node.Status.Conditions {
        fmt.Printf(&quot;\t%s: %s\n&quot;, condition.Type, condition.Status)
    }
}
</code></pre>
<p>Prints:</p>
<pre><code>dev-master-01
        NetworkUnavailable: False
        MemoryPressure: False
        DiskPressure: False
        PIDPressure: False
        Ready: True
dev-master-02
        NetworkUnavailable: False
        MemoryPressure: False
        DiskPressure: False
        PIDPressure: False
        Ready: True
dev-master-03
        NetworkUnavailable: False
        MemoryPressure: False
        DiskPressure: False
        PIDPressure: False
        Ready: True
</code></pre>
