问题
I am trying to get my hands dirty on Kubernetes. I am firing following command:
kubectl get deployment
and I get the following headers in the output:
I can't find the difference between current
and available
columns in the following output?
I know that official documentation gives a small description each of these fields, but it doesn't answer my following questions:
- Is
Current
<=Desired
true? - Is
Up-to-Date
<=Current
true? - Is
Up-to-Date
>Current
andUp-to-Date
<=Desired
true? - Is
Available
always <=Current
OR it can be >Available
?
In short, what is the relation between all these fields?
回答1:
The Deployment object specifies the desired state of your Deployment, and the Deployment Controller drives the current state of the system towards the desired state.
The Desired
field specifies the number of replicas you asked for, while the Current
field specifies the number of replicas that are currently running in the system. The Up-To-Date
field indicates the number of replicas that are up to date with the desired state. The Available
field shows the number of replicas that are passing readiness probes (if defined).
Is
Current
always <=Desired
? No, current can be greater than desired during a deployment update.Is
Up-to-date
always <=Current
? I believe the answer here is yes.Is
Up-to-date
>Current
? No, up-to-date should be the same as current, or less than current during a deployment update.Is
Available
always <=Current
? Yes.
I encourage you to go through a deployment update and scale out/in while using watch
to monitor these fields as the controller converges current state to desired state.
来源:https://stackoverflow.com/questions/51085740/what-is-the-difference-between-current-and-available-pod-replicas-in-kubernetes