Start your free 14-day ContainIQ trial

Kubectl Version: How To Check Your K8s Version

May 26, 2022

In this guide, we highlight the kubectl version command and provide an actionable example alongside helpful context.

Kumar Harsh
Software Developer
Kubernetes Monitoring
Made Simple.
Start Free Trial
No card required

Kubernetes is a popular container orchestration framework. It enables you to scale and manage large clusters of containers to deploy your applications efficiently to a large number users. Kubectl is a command-line tool that is used to manage your Kubernetes cluster.

In this guide, you will learn how to check the version of your Kubernetes resources using <terminal inline>kubectl version<terminal inline>.

Using Kubectl Version

<terminal inline>kubectl<terminal inline> provides a very simple command for viewing version details:


kubectl version

However, there are a number of ways you can use this command. Also, there are a few other things you might be looking for when viewing the version of your Kubernetes resources. Let’s take a look at them one by one.

Running kubectl version

You can view the cluster version using this command. Cluster version, here, refers to the version of the API server of your cluster. If you run the above command, you will receive a similar output:


Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.4", GitCommit:"b695d79d4f967c403a96986f1750a35eb75e75f1", GitTreeState:"clean", BuildDate:"2021-11-17T15:41:42Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"darwin/arm64"}
Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"816c97ab8cff8a1c72eccca1026f7820e93e0d25", GitTreeState:"clean", BuildDate:"2022-01-25T21:19:12Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"linux/arm64"}

The command returns two version details with quite verbose output.

The server version refers to the version of your Kubernetes API server. The client version refers to the version of your kubectl CLI.

Viewing Shorter Versions

You can switch to a cleaner version using the following command:


kubectl version --short

Now, you will receive a similar output:


Client Version: v1.22.4
Server Version: v1.23.3

Viewing the Client Version Only

You can also view only the client version by running the following command:


kubectl version --client

This will return only the <terminal inline>kubectl<terminal inline> CLI version to the output.


Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.4", GitCommit:"b695d79d4f967c403a96986f1750a35eb75e75f1", GitTreeState:"clean", BuildDate:"2021-11-17T15:41:42Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"darwin/arm64"}

This is useful in situations when your CLI is not connected to an active Kubernetes API server. You can still access the CLI version without getting an error.

Node Version

If you are looking for the version details of your nodes, you need to run the following command:


kubectl get nodes

In the output that will be generated, you will see the version of the kubelet of each node listed against it:

NAME STATUS ROLES AGE VERSION
minikube Ready control-plane,master 29d v1.23.3
minikube-m02 Ready <none> 10m v1.23.3

For a more generalistic approach, you can append <terminal inline>-o yaml<terminal inline> to most commands to get a more detailed output, possibly containing version details that you are looking for. For instance, you can also view the version details of the kubelets of each node by running <terminal inline>kubectl get nodes -o yaml<terminal inline> and searching through the output for “kubelet”.

Final Thoughts

Kubernetes is, without a doubt, one of the most complex open-source projects. In this guide, you learned how to view the version details for a wide variety of resources and entities in Kubernetes.

Start your free 14-day ContainIQ trial
Start Free TrialBook a Demo
No card required
Kumar Harsh
Software Developer

Kumar is a software developer and technical author. He has written for a number of software companies including LogRocket and Career Karma. Kumar previously worked for Goldman Sachs as a Summer Analyst. He is currently pursuing a Bachelor of Technology in Computer Science at the National Institute of Technology, Patna.

READ MORE