Kubernetes: Evenly distribute the replicas across the cluster

前端 未结 2 1054
暖寄归人
暖寄归人 2021-01-20 18:21

We can use DaemonSet object to deploy one replica on each node. How can we deploy say 2 replicas or 3 replicas per node? How can we achieve that. please let us know

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-20 18:41

    By default, the kubernetes scheduler will prefer to schedule pods on different nodes.

    1. The kubernetes scheduler will first determine all possible nodes where a pod can be deployed based on your affinity/anti-affinity/resource limits/etc.

    2. Afterward, the scheduler will find the best node where the pod can be deployed. The scheduler will automatically schedule the pods to be on separate availability zones and on separate nodes if this is possible of course.

    You can try this on your own. For example, if you have 3 nodes, try deploying 9 replicas of a pod. You will see that each node will have 2 pods running.

提交回复
热议问题