kubectl get deployments 输出与文档中的不同

kubectl get deployments output differ from this in documentation

当我运行这个命令

kubectl get deployments

在我的 Linux Ubuntu 18 机器上,我得到了与预期不同的输出(根据文档)。

预计:

实际:

当然,我说的不是价值观,我说的是标签名称。

[编辑]

我的k8s版本:

这只是一种旧的输出格式。您在下面获得的较新输出包含所有相同的信息; "READY" 字段是旧 "DESIRED" 和 "CURRENT" 的组合。

它在您的输出中显示为 4/5,表示需要 4 pods ready/current 和 5 pods。

希望对您有所帮助。

输出取决于客户端版本。让我们用同一个服务器检查一下

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:36:19Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}

$ kubectl get deployments kube-dns -n kube-system
NAME       DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
kube-dns   2         2         2            2           10d

切换 kubectl 版本会更改输出:

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:44:30Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:36:19Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}

$ kubectl get deployments kube-dns -n kube-system
NAME       READY   UP-TO-DATE   AVAILABLE   AGE
kube-dns   2/2     2            2           10d