Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:

kubectll get deployment

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?

like image 950
Mangu Singh Rajpurohit Avatar asked Dec 17 '22 22:12

Mangu Singh Rajpurohit


1 Answers

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.

like image 64
AlexBrand Avatar answered Dec 28 '22 22:12

AlexBrand