How to upgrade kubectl server version on Linux?

Viewed 798

I have this

kubectl version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.2", GitCommit:"f66044f4361b9f1f96f0053dd46cb7dce5e990a8", GitTreeState:"clean", BuildDate:"2022-06-15T14:22:29Z", GoVersion:"go1.18.3", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.4
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-30T20:19:45Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
WARNING: version difference between client (1.24) and server (1.18) exceeds the supported minor version skew of +/-1

I upgraded my client version using official install kubectl docs.

I installed kubeadm with snap

kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.2", GitCommit:"f66044f4361b9f1f96f0053dd46cb7dce5e990a8", GitTreeState:"clean", BuildDate:"2022-06-17T22:34:44Z", GoVersion:"go1.18.3", Compiler:"gc", Platform:"linux/amd64"}

How to upgrade server?

3 Answers

As you asked how to upgrade K8s : This document contains a step by step process to update K8’s

When your cluster is using the version 1.18.6, you could upgrade to 1.18.p where p >= 7 and to 1.19.x (whatever the value of x), but not to 1.20.x. If you plan to upgrade from 1.18.x to 1.20.x directly then the kubeadm upgrade plan command would fail so to overcome that you would first have to upgrade from 1.18.x to 1.19.x and from 1.19.x to 1.20.x. Post this needs to upgrade a Kubernetes cluster from version 1.19.x to version 1.20.x to 1.21 to 1.22 to 1.23.

Your server version is 1.18.x, which means you have to upgrade:

  1. 1.18.x -> 1.19.x
  2. 1.19.x -> 1.20.x
  3. 1.20.x -> 1.21.x
  4. 1.21.x -> 1.22.x
  5. 1.22.x -> 1.23.x
  6. 1.23.x -> 1.24.x

The documentation for each step can be found here.

kubectl is only a client application to talk to the k8s api. so upgrading kubectl does not affect the server in any way. you'll have to upgrade your kubernetes installation, as mentioned above.

Related