You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: You cannot rollback a paused Deployment until you resume it.
455
455
456
456
457
+
## Deployment status
458
+
459
+
A Deployment enters various states during its lifecycle. It can be [progressing](#progressing-deployment) while rolling out a new ReplicaSet,
460
+
it can be [complete](#complete-deployment), or it can [fail to progress](#failed-deployment).
461
+
462
+
### Progressing Deployment
463
+
464
+
Kubernetes marks a Deployment as _progressing_ when one of the following tasks is performed:
465
+
466
+
* The Deployment is in the process of creating a new ReplicaSet.
467
+
* The Deployment is scaling up an existing ReplicaSet.
468
+
* The Deployment is scaling down an existing ReplicaSet.
469
+
470
+
You can monitor the progress for a Deployment by using `kubectl rollout status`.
471
+
472
+
### Complete Deployment
473
+
474
+
Kubernetes marks a Deployment as _complete_ when it has the following characteristics:
475
+
476
+
* The Deployment has minimum availability. Minimum availability means that the Deployment's number of available replicas
477
+
equals or exceeds the number required by the Deployment strategy.
478
+
* All of the replicas associated with the Deployment have been updated to the latest version you've specified, meaning any
479
+
updates you've requested have been completed.
480
+
481
+
You can check if a Deployment has completed by using `kubectl rollout status`. If the rollout completed successfully, `kubectl rollout status` returns a zero exit code.
482
+
483
+
```
484
+
$ kubectl rollout status deploy/nginx
485
+
Waiting for rollout to finish: 2 of 3 updated replicas are available...
486
+
deployment "nginx" successfully rolled out
487
+
$ echo $?
488
+
0
489
+
```
490
+
491
+
### Failed Deployment
492
+
493
+
Your Deployment may get stuck trying to deploy its newest ReplicaSet without ever completing. This can occur due to some of the following factors:
494
+
495
+
* Insufficient quota
496
+
* Readiness probe failures
497
+
* Image pull errors
498
+
* Insufficient permissions
499
+
* Limit ranges
500
+
* Application runtime misconfiguration
501
+
502
+
One way you can detect this condition is to specify specify a deadline parameter in your Deployment spec: ([`spec.progressDeadlineSeconds`](#progress-deadline-seconds)). `spec.progressDeadlineSeconds` denotes the number of seconds the Deployment controller waits before indicating (via the Deployment status) that the Deployment progress has stalled.
503
+
504
+
The following `kubectl` command sets the spec with `progressDeadlineSeconds` to make the controller report lack of progress for a Deployment after 10 minutes:
Once the deadline has been exceeded, the Deployment controller adds a DeploymentCondition with the following attributes to
511
+
the Deployment's `status.conditions`:
512
+
513
+
* Type=Progressing
514
+
* Status=False
515
+
* Reason=ProgressDeadlineExceeded
516
+
517
+
See the [Kubernetes API conventions](https://github.com/kubernetes/kubernetes/blob/{{page.githubbranch}}/docs/devel/api-conventions.md#typical-status-properties) for more information on status conditions.
518
+
519
+
Note that in version 1.5, Kubernetes will take no action on a stalled Deployment other than to report a status condition with
520
+
`Reason=ProgressDeadlineExceeded`.
521
+
522
+
**Note:** If you pause a Deployment, Kubernetes does not check progress against your specified deadline. You can safely pause a Deployment in the middle of a rollout and resume without triggering a the condition for exceeding the deadline.
523
+
524
+
You may experience transient errors with your Deployments, either due to a low timeout that you have set or due to any other kind
525
+
of error that can be treated as transient. For example, let's suppose you have insufficient quota. If you describe the Deployment
526
+
you will notice the following section:
527
+
528
+
```
529
+
$ kubectl describe deployment nginx-deployment
530
+
<...>
531
+
Conditions:
532
+
Type Status Reason
533
+
---- ------ ------
534
+
Available True MinimumReplicasAvailable
535
+
Progressing True ReplicaSetUpdated
536
+
ReplicaFailure True FailedCreate
537
+
<...>
538
+
```
539
+
540
+
If you run `kubectl get deployment nginx-deployment -o yaml`, the Deployement status might look like this:
541
+
542
+
```
543
+
status:
544
+
availableReplicas: 2
545
+
conditions:
546
+
- lastTransitionTime: 2016-10-04T12:25:39Z
547
+
lastUpdateTime: 2016-10-04T12:25:39Z
548
+
message: Replica set "nginx-deployment-4262182780" is progressing.
549
+
reason: ReplicaSetUpdated
550
+
status: "True"
551
+
type: Progressing
552
+
- lastTransitionTime: 2016-10-04T12:25:42Z
553
+
lastUpdateTime: 2016-10-04T12:25:42Z
554
+
message: Deployment has minimum availability.
555
+
reason: MinimumReplicasAvailable
556
+
status: "True"
557
+
type: Available
558
+
- lastTransitionTime: 2016-10-04T12:25:39Z
559
+
lastUpdateTime: 2016-10-04T12:25:39Z
560
+
message: 'Error creating: pods "nginx-deployment-4262182780-" is forbidden: exceeded quota:
Eventually, once the Deployment progress deadline is exceeded, Kubernetes updates the status and the reason for the Progressing condition:
571
+
572
+
```
573
+
Conditions:
574
+
Type Status Reason
575
+
---- ------ ------
576
+
Available True MinimumReplicasAvailable
577
+
Progressing False ProgressDeadlineExceeded
578
+
ReplicaFailure True FailedCreate
579
+
```
580
+
581
+
You can address an issue of insufficient quota by scaling down your Deployment, by scaling down other controllers you may be running,
582
+
or by increasing quota in your namespace. If you satisfy the quota conditions and the Deployment controller then completes the Deployment
583
+
rollout, you'll see the Deployment's status update with a successful condition (`Status=True` and `Reason=NewReplicaSetAvailable`).
584
+
585
+
```
586
+
Conditions:
587
+
Type Status Reason
588
+
---- ------ ------
589
+
Available True MinimumReplicasAvailable
590
+
Progressing True NewReplicaSetAvailable
591
+
```
592
+
593
+
`Type=Available` with `Status=True` means that your Deployment has minimum availability. Minimum availability is dictated
594
+
by the parameters specified in the deployment strategy. `Type=Progressing` with `Status=True` means that your Deployment
595
+
is either in the middle of a rollout and it is progressing or that it has successfully completed its progress and the minimum
596
+
required new replicas are available (see the Reason of the condition for the particulars - in our case
597
+
`Reason=NewReplicaSetAvailable` means that the Deployment is complete).
598
+
599
+
You can check if a Deployment has failed to progress by using `kubectl rollout status`. `kubectl rollout status` returns a non-zero exit code if the Deployment has exceeded the progression deadline.
600
+
601
+
```
602
+
$ kubectl rollout status deploy/nginx
603
+
Waiting for rollout to finish: 2 out of 3 new replicas have been updated...
604
+
error: deployment "nginx" exceeded its progress deadline
605
+
$ echo $?
606
+
1
607
+
```
608
+
609
+
### Operating on a failed deployment
610
+
611
+
All actions that apply to a complete Deployment also apply to a failed Deployment. You can scale it up/down, roll back
612
+
to a previous revision, or even pause it if you need to apply multiple tweaks in the Deployment pod template.
613
+
457
614
## Use Cases
458
615
459
616
### Canary Deployment
@@ -556,6 +713,17 @@ the rolling update starts, such that the total number of old and new Pods do not
556
713
the new Replica Set can be scaled up further, ensuring that the total number of Pods running
557
714
at any time during the update is at most 130% of desired Pods.
558
715
716
+
### Progress Deadline Seconds
717
+
718
+
`.spec.progressDeadlineSeconds` is an optional field that specifies the number of seconds you want
719
+
to wait for your Deployment to progress before the system reports back that the Deployment has
720
+
[failed progressing](#failed-deployment) - surfaced as a condition with `Type=Progressing`, `Status=False`.
721
+
and `Reason=ProgressDeadlineExceeded` in the status of the resource. The deployment controller will keep
722
+
retrying the Deployment. In the future, once automatic rollback will be implemented, the deployment
723
+
controller will roll back a Deployment as soon as it observes such a condition.
724
+
725
+
If specified, this field needs to be greater than `.spec.minReadySeconds`.
726
+
559
727
### Min Ready Seconds
560
728
561
729
`.spec.minReadySeconds` is an optional field that specifies the
0 commit comments