简体   繁体   中英

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

      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. From the documentation

By default 'rollout status' will watch the status of the latest rollout until it's done

My question:

1/ Which actions are the parts that contribute to the deployment "until it's done" (resource creation, resource teardown?... )

2/ Does readinessProbe and livenessProbe contribute to the deployment time

The criteria for this are in the kubectl source . 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)
  • Its current-replica count is at most its updated-replica count (every old pod has been destroyed)
  • Its available-replica count is at least its updated-replica count (every new pod is running)

You can use kubectl get deployment -w or kubectl get pod -w to watch a deployment actually happen in real time; the kubectl get -w option watches the given resources and prints out a new line whenever they change. You'll see the following sequence occur (with default Deployment settings, one at a time for "small" deployments):

  1. A new pod is created
  2. The new pod passes its probes and become ready
  3. An old pod is terminated
  4. The old pod actually exits and is deleted

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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