<p>I have a kubernetes cluster that runs some legacy containers (windows containers) .
To simplify , let's say that the container can handle max 5 requests at a time something like </p>

<pre><code>handleRequest(){
   requestLock(semaphore_Of_5)
   sleep(2s)
   return "result"
}
</code></pre>

<p>So the cpu is not spiked . I need to scale based on nr of active connections </p>

<p>I can see from the documentation <a href="https://kubernetes.io/docs/concepts/services-networking/service/#proxy-mode-iptables" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/#proxy-mode-iptables</a> </p>

<pre><code>You can use Pod readiness probes to verify that backend Pods are working OK, so that kube-proxy in iptables mode only sees backends that test out as healthy. Doing this means you avoid having traffic sent via kube-proxy to a Pod that’s known to have failed.
</code></pre>

<p>So there is a mechanism to make pods available for routing new requests but it is the livenessProbe that actually mark the pod as unhealthy and subject to restart policy. But my pods are just busy. They don't need restarting.</p>

<p>How can I increase the nr of pods in this case ?</p>

Ovidiu Buligan
<p>You can enable HPA for the deployment.</p>

<p>You can autoscale on the no of requests metrics and perform autoscaling on this metric.</p>

<p><a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#autoscaling-on-metrics-not-related-to-kubernetes-objects" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#autoscaling-on-metrics-not-related-to-kubernetes-objects</a></p>

<p>I would also recommend to configure liveness probe <code>failureThreshold</code> and <code>timeoutSeconds</code>, check if it helps.</p>

<p><a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes</a></p>
