How to Check Kubernetes Version on Linux

Checking the installed version of Kubernetes is an important part of system administration, since it will allow you to keep on top of the latest updates and security patches that are released for your software. It is also important to ensure that your various Kubernetes components are updated alongside each other, as much variance in the version number could cause problems.

In this tutorial, we will show you how to check the version of Kubernetes on a Linux system. This will include the installed version of the Kubernetes cluster, the kubectl command version, and the version that the nodes on your cluster are running.

In this tutorial you will learn:

  • How to check Kubernetes server and client version in Linux
How to Check Kubernetes Version on Linux
How to Check Kubernetes Version on Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software Kubernetes
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to Check Kubernetes Version on Linux




Check out the example commands below, which allow us to check the version of Kubernetes and related components on your Linux system.

  1. The easiest way to quickly retrieve the version information for Kubernetes is with the following command and the --short option.
    $ kubectl version --short
    Client Version: v1.26.2
    Kustomize Version: v4.5.7
    Server Version: v1.26.1
    

    We can run this command on both the master and worker nodes. The server version is the version of the Kubernetes master, and the client version is the version of the worker node on which you are executing the command.

  2. To see much more verbose output about the installed version and relevant information, we can append the --output=yaml or --output=json options to our kubectl version command.
    $ kubectl version --output=yaml
    
    Getting verbose version information in Kubernetes
    Getting verbose version information in Kubernetes
  3. Rather than logging into each node to check their installed version, we can run the kubectl get nodes command from our master node to see the installed verison of Kubernetes on all of the nodes in the cluster.


    $ kubectl get nodes
    NAME       STATUS   ROLES           AGE   VERSION
    minikube   Ready    control-plane   18m   v1.26.1
    
  4. You can check the installed version of kubectl by using the --client option:
    $ kubectl version --client
    

    If you find it is out of date, you can use our tutorial on How to Install kubectl Linux Binary to update it.

    NOTE
    Keep in mind that your kubectl version should correspond with the rest of your cluster. In other words, it is recommended to keep everything up to date, rather than updating kubectl on its own, or letting it fall out of date from the rest of the cluster. If the kubectl version does not match up with your cluster, it is likely to cause issues.

Closing Thoughts




In this tutorial, we saw how to check the Kubernetes version on a Linux system. This included the server version for the Kubernetes master node, and the version installed on all worker nodes in the cluster. It is important to keep an eye on your version number to see if there are any widespread errors being reported, and to keep your software up to date to avoid future issues.



Comments and Discussions
Linux Forum