Can the pods at any time be more than the replicas mentioned in replicaset

11/6/2019

In the replicas I have mentioned 3 replicas of a pod. I am new to this, can you please suggest if specifying 3 in the replicas will ensure all the 3 pods running all the time? Also, if at any situation can the number of pods be more than the replicas mentioned in the configuration?

-- sam
kubernetes

1 Answer

11/6/2019

You could have founded your answer in the documentation: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/

By default only using what you mentionned and with no configuration to see, I would say yes to the first question. If you launch a deployment with only configuration for replicaset in deployment to 3, the number of pod will always be 3.

Now for the second question, you simply have to define an hpa to be able to overwrite the replicaset configuration. By default the deployment will create the set number of replicas you asked for, best practice being that you defined a number of replicas at the minimal number of replicas setted in the hpa, if more, you would have the number, if less, the hpa would launch more replicas.

-- night-gold
Source: StackOverflow