<p>you are going the right way with PodTopologySpreadConstraints(PTSC for short) to have different instance of the same pod in an uneven distribution through all your k8s nodes.
On that note, I would remind you that you can pair various PTSC rules to achieve your desired goal. Based on instance type labels as well as per availability zone.</p>
<p>But what is missing, and could be a solution to your problem, is to incrementally send a slice of your traffic to those pods in order to do a comparison in performance or whatever you want to compare.</p>
<p>You should look into what your ingress controller can manage. For instance, NGINX ingress-controller uses <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#canary" rel="nofollow noreferrer">canary deployments</a> and Traefik ingress-controller uses <a href="https://traefik.io/glossary/kubernetes-deployment-strategies-blue-green-canary/" rel="nofollow noreferrer">Green-blue deployments</a> to send a certain percentage of traffic to those &quot;test&quot; pod and once you have your metrics you can go on and complete the rollout.</p>

CC BY-SA 4.0
2022-06-01T15:05:41.117Z
2022-06-01T15:05:41.117Z
Alberto P.
<p>What I'd like to do is distribute 10% of my pods to one instance group with the other 90% on the other group.</p>
<p>I would like to experiment with using different AWS instance types (AMD, graviton, etc) but I only want to put a limited number of pods onto these instances.  Ideally, I'd like to do it by service.</p>
<p>I've looked into PodTopologySpread but it appears to try to get roughly even distributions within a range.  Alternatively, set the pod scheduler to prefer the different instance type and just limit how many nodes I can run but that doesn't work well if multiple services are in the instance group.  The final option is to have two deployment objects with different node counts and but the same service selectors.  That would work but seems like a work to tweak pod distributions.</p>
<p>How can I distribute a small number of pods to different instance types?</p>

<kubernetes><amazon-ec2><kops>
How can I unevenly distribute pods across Instance Groups
Mark Robinson
# How can I unevenly distribute pods across Instance Groups

(Asked by: username_0 on 2022-05-29)

What I'd like to do is distribute 10% of my pods to one instance group with the other 90% on the other group.

I would like to experiment with using different AWS instance types (AMD, graviton, etc) but I only want to put a limited number of pods onto these instances. Ideally, I'd like to do it by service.

I've looked into PodTopologySpread but it appears to try to get roughly even distributions within a range. Alternatively, set the pod scheduler to prefer the different instance type and just limit how many nodes I can run but that doesn't work well if multiple services are in the instance group. The final option is to have two deployment objects with different node counts and but the same service selectors. That would work but seems like a work to tweak pod distributions.

How can I distribute a small number of pods to different instance types?

**Tags:** kubernetes, amazon-ec2, kops


---

## 1 answers

### Answer by username_1 on 2022-06-01. Score: 0

you are going the right way with PodTopologySpreadConstraints(PTSC for short) to have different instance of the same pod in an uneven distribution through all your k8s nodes.
On that note, I would remind you that you can pair various PTSC rules to achieve your desired goal. Based on instance type labels as well as per availability zone.

But what is missing, and could be a solution to your problem, is to incrementally send a slice of your traffic to those pods in order to do a comparison in performance or whatever you want to compare.

You should look into what your ingress controller can manage. For instance, NGINX ingress-controller uses [canary deployments](https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#canary) and Traefik ingress-controller uses [Green-blue deployments](https://traefik.io/glossary/kubernetes-deployment-strategies-blue-green-canary/) to send a certain percentage of traffic to those "test" pod and once you have your metrics you can go on and complete the rollout.


---

