【问题标题】:Any alternate command of Kubectl describe pods <podname>Kubectl 的任何替代命令描述 pods <podname>
【发布时间】:2019-03-10 10:21:30
【问题描述】:

我是 Dev Ops 的新手。我正在 VSTS 中设置 CD 管道。我已经使用 Deploy to Kubernetes 任务来部署应用程序,它工作正常。

在部署到 Kubernetes 任务之后,我又添加了一个部署到 Kubernetes 任务,我想执行下面的命令

kubectl describe pods &lt;podname&gt;

上面的命令描述了 pod。

我可以看到部署到 Kubernetes 任务(在 VSTS 管道中)中没有这样的命令可用于描述。

只有get, apply, set, exec, login, logout, create, delete, expose, run and top是可用的命令。

通过执行上述命令,我想确保每个 pod 都在运行。

如何在 VSTS CD 管道中执行 describe 命令?

替代选项是任何其他命令,它将返回与describe pods &lt;podname&gt; 命令相同的输出。

【问题讨论】:

  • 你需要从 kubectl describe 得到哪些数据?
  • kubectl get po name 返回状态,因此它提供了您所要求的内容
  • @Amityo: 主要是我需要下面的状态条件: 类型 状态 Initialized True Ready True ContainersReady True PodScheduled True
  • @4c74356b41:命令不起作用。
  • 不工作是什么意思?大声笑

标签: azure kubernetes azure-devops azure-pipelines azure-aks


【解决方案1】:

您可以使用标签找到您感兴趣的 pod:

$ kg po --show-labels
NAME                                 READY     STATUS    RESTARTS   AGE       LABELS
frontend-76dc7bfc6d-7zcb8            1/1       Running   0          9h        app=Frontend,branch=develop,pod-template-hash=76dc7bfc6d
identityserverapp-f9684fc77-z9wtb    1/1       Running   0          9h        app=IdentityServerApp,branch=develop,pod-template-hash=f9684fc77

$ kg po --selector=app=Frontend
NAME                        READY     STATUS    RESTARTS   AGE
frontend-76dc7bfc6d-7zcb8   1/1       Running   0          9h

ps。 kg = kubectl get 的别名

【讨论】:

    猜你喜欢
    • 2021-10-06
    • 2020-09-15
    • 1970-01-01
    • 1970-01-01
    • 2017-11-22
    • 2011-09-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多