Arkira
Arkira

Reputation: 13

k8s replicaSet status is confusing

I have two services:

I ran kubectl get all. I see the line 3 and 4 of replicaSet section has everything as 0, why do we have those two lines when nothing is available?

replicaset.apps/bayonetta-deployment-5b75868d89   2         2         2       3h36m
replicaset.apps/bayonetta-deployment-5c65f74c8b   0         0         0       176m
replicaset.apps/hide-deployment-575b6bc68d        0         0         0       3h12m
replicaset.apps/hide-deployment-66d955986b        1         1         1       155m

enter image description here

Upvotes: 1

Views: 68

Answers (2)

Praveen Sripati
Praveen Sripati

Reputation: 33495

K8S maintains multiple versions of ReplicationSets, this enables the rollback of a Deployment because of a bug or some other reason. More about it here (1). K8S maintains revisionHistoryLimit number of ReplicationSets which defaults to 10 (2).

Upvotes: 0

Amit Kumar Gupta
Amit Kumar Gupta

Reputation: 18567

You probably updated your Deployments, which results in scaling up new ReplicaSets and scaling down the existing ones. See the Kubernetes docs here, with the example:

Run kubectl get rs to see that the Deployment updated the Pods by creating a new ReplicaSet and scaling it up to 3 replicas, as well as scaling down the old ReplicaSet to 0 replicas.

kubectl get rs

The output is similar to this:

NAME                          DESIRED   CURRENT   READY   AGE
nginx-deployment-1564180365   3         3         3       6s
nginx-deployment-2035384211   0         0         0       36s

Upvotes: 3

Related Questions