Hugo Marques
Hugo Marques

Reputation: 23

Limit replicas per node on Kubernetes

Is there a way to limit the number os replicas per node in Kubernetes? I found some info about Spreading Constraints but didn't understand if this is possible.

Example: I want to have only 1 replica per node on the cluster.

I know that K8S automatically balances the replicas spreading across the nodes, but I want to enforce a specific limit in each node.

Is this possible?

Upvotes: 1

Views: 1507

Answers (3)

slashpai
slashpai

Reputation: 1169

You can create daemon set which makes sure every node in the cluster runs exactly one replica

Upvotes: 1

hoque
hoque

Reputation: 6471

If you want to ensure that all nodes have single replica on them you can use a DaemonSet.

Upvotes: 3

coderanger
coderanger

Reputation: 54191

The scheduler has many ways to just about everything but in the particular case of 1 replica per node you can use a required mode anti-affinity.

Upvotes: 2

Related Questions