How can I check the Kubernetes version I’m running in production cluster?. When planning to upgrade your Kubernetes cluster components you may want to know the current version of these components before beginning the upgrade. Kubernetes is the most popular open-source container-orchestration system which enables you to automate deployment, scaling and overall management of containerized applications.

To check the version of various kubernetes components use the commands explained in the next sections.

Check Kubeadm version

Login to your Kubernetes machine which you’re planning on upgrading and run the command below.

$ kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:17:50Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}

As seen in the output the version I’ve installed is 1.17.0

Check kubelet version

For kubelet use the command below to confirm the version that has been installed.

$ kubelet --version
Kubernetes v1.17.0

Check kubectl and Kubernetes API version

For the Kubernetes API and the kubectl client version use the following command:

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:20:10Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}

Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:12:17Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}

The first line shows the kubectl client version and the second line contains the apiserver version.

If you want much shorter versions use:

$ kubectl version --short
Client Version: v1.17.0
Server Version: v1.17.0

Only get API server version:

$ kubectl version  --short | grep -i server
Server Version: v1.17.0

If you’re authenticated to Kubernetes API you can use curl with proxy to pull version details.

# On terminal 1
$ kubectl proxy
Starting to serve on 127.0.0.1:8001

# Launch terminal 2 while keeping 1 open
$ curl -ik  http://localhost:8001/version 
HTTP/1.1 200 OK
Content-Length: 263
Content-Type: application/json
Date: Wed, 09 Dec 2020 10:05:57 GMT

{
  "major": "1",
  "minor": "17",
  "gitVersion": "v1.17.0",
  "gitCommit": "70132b0f130acc0bed193d9ba59dd186f0e634cf",
  "gitTreeState": "clean",
  "buildDate": "2019-12-07T21:12:17Z",
  "goVersion": "go1.13.4",
  "compiler": "gc",
  "platform": "linux/amd64"

Similar guides on Kubernetes.

How To Run Rancher k3s Kubernetes in Docker Containers

Run Kubernetes on Linux Mint with Minikube

Install MicroK8s Kubernetes Cluster on Linux Mint

Best Grafana and Prometheus Monitoring books

LEAVE A REPLY

Please enter your comment!
Please enter your name here