What is the difference between current and available pod replicas in kubernetes deployment?

那年仲夏 提交于 2021-02-07 07:59:34

问题


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:

  1. Is Current <= Desired true?
  2. Is Up-to-Date <= Current true?
  3. Is Up-to-Date > Current and Up-to-Date <= Desired true?
  4. 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).

  1. Is Current always <= Desired? No, current can be greater than desired during a deployment update.

  2. Is Up-to-date always <= Current? I believe the answer here is yes.

  3. Is Up-to-date > Current? No, up-to-date should be the same as current, or less than current during a deployment update.

  4. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!