Search code examples
kuberneteskubernetes-podkubernetes-deployment

Can a deployment ensure that there is never more than one pod running?


If I have a deployment with only a single replica defined, can I ensure that only ever one pod is running?

I noticed that when I do something like kubectl rollout for a very short amount of time I will see two pods in my logs.


Solution

  • If I have a deployment with only a single replica defined, can I ensure that only ever one pod is running?

    It sounds like you are asking for "at most one Pod" semantics. Also consider what happens when a Node becomes unresponsive.

    This is point where Deployment and StatefulSet has different behavior.

    Deployment

    Has at least one Pod behavior, and may scale up new pods if it is unclear it at least one is running.

    StatefulSet

    Has at most one Pod behavior, and make sure to not scale up more pods if it is unclear if at most one is running.