Kubectl 服务器和客户端版本

Kubectl server and client versions

听说Kubectl是client版本,Kubernetes集群的Kubernetes APIServer是server版本...但是我还是不太明白这个。这个客户端版本在哪里?它在控制平面上吗? .. 客户端和服务器版本实际上都表示“kubectl”,但在两个不同的地方。 我的客户端版本为 1.23,我的服务器版本为 1.18.20...但是当我执行 kubectl get nodes 时,它表示节点位于 1.18.9 所以基本上我想问的是......“客户端”和“服务器”版本都与 kubectl 版本相关吗?

当我们运行 kubectl version,我们获取服务器和客户端的详细信息。

Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.5+k3s1", GitCommit:"405bf79da97831749733ad99842da638c8ee4802", GitTreeState:"clean", BuildDate:"2021-12-18T00:43:30Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.5+k3s1", GitCommit:"405bf79da97831749733ad99842da638c8ee4802", GitTreeState:"clean", BuildDate:"2021-12-18T00:43:30Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"linux/amd64"}

这里,Server Version代表Kubernetes控制平面的版本。控制平面包括api-serveretcd、各种控制器等

Client Version代表Kubectl工具的版本。 Kubectl 是一个与控制平面交互的客户端工具。

Kubectl 可以独立于 Kubernetes 集群而存在。

根据kubectl doc

You must use a kubectl version that is within one minor version difference of your cluster. For example, a v1.23 client can communicate with v1.22, v1.23, and v1.24 control planes. Using the latest compatible version of kubectl helps avoid unforeseen issues.

在你的情况下,你的服务器版本似乎远远落后于客户端版本。