<pre><code>[root@gx dashboard]# kubectl get node
NAME       STATUS   ROLES    AGE     **VERSION**
minikube   Ready    master   7d20h   **v1.15.0**
</code></pre>

<p>returns the version for a particular node. How do I do this using client-go?</p>

Gao.Xin
<p>Sample code for getting Kubernetes version from <code>NodeInfo</code> using Go-client:</p>

<pre class="lang-golang prettyprint-override"><code>// Create clientset 
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
  panic(err.Error())
}

// Get node object
node, err := clientset.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{})
if err != nil {
  panic(err.Error())
}

// You can read Kubernetes version from either KubeletVersion or KubeProxyVersion
kVersion := node.Status.NodeInfo.KubeletVersion
// kVersion := node.Status.NodeInfo.KubeProxyVersion
fmt.Println(kVersion)
</code></pre>
