Search code examples
kuberneteskubectl

Meaning of "available" and "unavailable" in kubectl describe deployment


Readiness probe success or not determine the pod ready or not ready. If I set the .spec.minReadySeconds = 60 and the Readiness probe is success(.readinessProbe.initialDelaySeconds = 1), so when we created the deployment more than 1 second less than 60 seconds the pod enter the ready status but the deployment's 'status' like below:

kubectl describe deployment readiness-minreadyseconds
Name:           readiness-minreadyseconds
Namespace:      default
CreationTimestamp:  Wed, 21 Sep 2016 10:34:42 +0800
Labels:         add=readiness-minreadyseconds
Selector:       name=readiness-minreadyseconds
Replicas:       2 updated | 2 total | 0 available | 2 unavailable
StrategyType:       RollingUpdate
MinReadySeconds:    45
RollingUpdateStrategy:  1 max unavailable, 1 max surge
OldReplicaSets:     <none>
NewReplicaSet:      readiness-minreadyseconds-536553145 (2/2 replicas created)
Events:
  FirstSeen LastSeen    Count   From                SubobjectPath   Type        Reason          Message
  --------- --------    -----   ----                -------------   --------    ------          -------
  2s        2s      1   {deployment-controller }            Normal      ScalingReplicaSet   Scaled up replica set readiness-minreadyseconds-536553145 to 2

I found that we can access the resource from container by type nodeport, so if there are some pod unavailable in the deployment, how it could affect me?


Solution

  • This may be a misunderstanding of the terminology. From the deployment documentation, one has:

    .spec.minReadySeconds is an optional field that specifies the minimum number of seconds for which a newly created Pod should be ready without any of its containers crashing, for it to be considered available.

    So the minReadySeconds is set to 60, it needs to be up for 60 seconds without any crashes to be considered "available". So, what you're seeing is that even though your pods have been marked ready, they're not satisfying that condition of minReadySeconds yet.