简体   繁体   English

kubectl rollout status - 命令何时完成?

[英]kubectl rollout status - When the command complete?

Currently I am using this in my pipeline目前我在我的管道中使用它

kubectl apply -f deployment.yaml && kubectl rollout status -f deployment.yaml

With this in yaml有了这个在yaml

      readinessProbe:
        tcpSocket:
          port: 90
        initialDelaySeconds: 120
        periodSeconds: 10
        timeoutSeconds: 10
        failureThreshold: 1
        successThreshold: 1
      livenessProbe:
        tcpSocket:
          port: 90
        initialDelaySeconds: 120
        periodSeconds: 20
        timeoutSeconds: 2
        failureThreshold: 1
        successThreshold: 1

For me, kubectl rollout is running for a very long time, blocking the deployment pipeline.对我来说,kubectl rollout 运行了很长时间,阻塞了部署管道。 From the documentation文档

By default 'rollout status' will watch the status of the latest rollout until it's done默认情况下,'rollout status' 会观察最新的 rollout 状态,直到它完成

My question:我的问题:

1/ Which actions are the parts that contribute to the deployment "until it's done" (resource creation, resource teardown?... ) 1/ 哪些操作是有助于部署“直到完成”的部分(资源创建、资源拆除?...)

2/ Does readinessProbe and livenessProbe contribute to the deployment time 2/ readinessProbe 和 livenessProbe 对部署时间有影响吗

The criteria for this are in the kubectl source .其标准kubectl源中 A deployment is "complete" if:如果出现以下情况,则部署是“完成”的:

  • It hasn't timed out它没有超时
  • Its updated-replica count is at least its desired-replica count (every new pod has been created)它的更新副本计数至少是它的期望副本计数(每个新 pod 都已创建)
  • Its current-replica count is at most its updated-replica count (every old pod has been destroyed)它的当前副本数量最多是它的更新副本数量(每个旧 pod 都已被销毁)
  • Its available-replica count is at least its updated-replica count (every new pod is running)它的可用副本计数至少是它的更新副本计数(每个新 Pod 都在运行)

You can use kubectl get deployment -w or kubectl get pod -w to watch a deployment actually happen in real time;您可以使用kubectl get deployment -wkubectl get pod -w来实时观察实际发生的部署; the kubectl get -w option watches the given resources and prints out a new line whenever they change. kubectl get -w选项kubectl get -w给定的资源并在它们发生变化时打印出一个新行。 You'll see the following sequence occur (with default Deployment settings, one at a time for "small" deployments):您将看到以下序列发生(使用默认部署设置,“小型”部署一次一个):

  1. A new pod is created创建了一个新的 Pod
  2. The new pod passes its probes and become ready新 Pod 通过其探测并准备就绪
  3. An old pod is terminated一个旧的 pod 被终止
  4. The old pod actually exits and is deleted旧的pod实际上退出并被删除

So for kubectl rollout status deployment/... to finish, all of these steps must happen – new pods are created, new pods all pass their health checks, old pods are destroyed – for every replica in the deployment.因此,对于kubectl rollout status deployment/...完成,所有这些步骤都必须发生——创建新的 pod,新的 pod 都通过健康检查,销毁旧的 pod——对于部署中的每个副本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM