k8s replicaSet status is confusing

4/5/2020

I have two services:

  • bayonetta: backend clusterIp service, replicaset=2
  • hide: frontend nodePort service, replicaset=1

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

-- Arkira
kubernetes

2 Answers

4/6/2020

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

-- Praveen Sripati
Source: StackOverflow

4/5/2020

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
-- Amit Kumar Gupta
Source: StackOverflow