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

1

6

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?

Bright answered 28/6, 2018 at 14:42 Comment(0)
H
13

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.

Hairsplitting answered 28/6, 2018 at 17:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.