<p>I have deployed a traefik ingress and an statefulset with 2 containers. Due to a point load pod number 1 is at 90% of cpu but still receiving traffic, there is some way that pod number 1 stops receiving traffic due to cpu load and route all requests to pod number 2?</p>
<p>Thanks in advance</p>

silvia Dominguez
<p>If you want to redirect the traffic in relation to the resource usage there isn't a straightforward solution.</p>
<p>What you can do and is more appropriate for most usecases, since you don't overload also the other pods in the cluster, is to configure your application to have a load balancer and then scale out/in the pods compared to the amount of used request:</p>
<ul>
<li>To configure a load balancer you can use a Ingress or a IngressRoute, depending on the version of Traefik, that routes the traffic to a ClusterIp Service exposing the cluster of statefulset pods.</li>
<li>On Traefik you can configure some load balancing parameters (<a href="https://doc.traefik.io/traefik/routing/providers/kubernetes-crd/" rel="nofollow noreferrer">https://doc.traefik.io/traefik/routing/providers/kubernetes-crd/</a>), such as <em>strategy</em>, <em>weight</em>.</li>
<li>Then, on top of this architectrue, you can configure the K8s HorizontalPodAutoscaler to automatically scale the number of pods.</li>
</ul>
