How to Check Kubernetes Version Quickly and Easily
To check the Kubernetes version, use the
kubectl version --short command to see client and server versions. Alternatively, use kubeadm version to check the kubeadm tool version.Syntax
The main command to check Kubernetes version is kubectl version. Adding --short shows a concise output. You can also use kubeadm version to check the kubeadm tool version.
kubectl version [--short]: Shows client and server Kubernetes versions.kubeadm version: Shows kubeadm tool version.
bash
kubectl version --short kubeadm version
Example
This example shows how to run the commands and the typical output you get. It demonstrates checking both the client and server Kubernetes versions.
bash
kubectl version --short kubeadm version
Output
Client Version: v1.27.3
Server Version: v1.27.3
kubeadm version: &version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.3", GitCommit:"abcdef123456", GitTreeState:"clean", BuildDate:"2024-06-01T12:00:00Z", GoVersion:"go1.20", Compiler:"gc", Platform:"linux/amd64"}
Common Pitfalls
Sometimes users run kubectl version without proper cluster access, so the server version does not show. Also, using kubectl version without --short gives a verbose output that can be confusing.
Make sure your kubectl is configured to connect to your cluster to see the server version.
bash
kubectl version # This shows a lot of JSON output which can be hard to read kubectl version --short # This shows a clean, easy-to-read version output
Quick Reference
Use these commands to quickly check Kubernetes versions:
kubectl version --short: Check client and server versions.kubeadm version: Check kubeadm tool version.- Ensure
kubectlis configured to access your cluster to see server version.
Key Takeaways
Use
kubectl version --short to see concise client and server Kubernetes versions.Ensure your
kubectl is connected to the cluster to get the server version.Use
kubeadm version to check the kubeadm tool version separately.Avoid using
kubectl version without --short for easier reading.Checking versions helps confirm your Kubernetes setup and troubleshoot compatibility.