<p>We have a service which is fairly idle most of the time, hence it would be great for us if we could delete all the pods when the service is not getting any request for say 30 minutes, and in the next time when a new request comes Kubernetes will create the first pod and process the response.</p>

<p>Is it possible to set the min pod instance count to 0?</p>

<p>I found that currently,  Kubernetes does not support this, is there a way I can achieve this?</p>

Gautam Moulik
<p>This is not supported in Kubernetes the way it's supported by web servers like nginx, apache or app engines like <a href="https://github.com/puma/puma" rel="nofollow noreferrer">puma</a>, <a href="https://github.com/phusion/passenger" rel="nofollow noreferrer">passenger</a>, <a href="https://gunicorn.org/" rel="nofollow noreferrer">gunicorn</a>, <a href="https://bogomips.org/unicorn/" rel="nofollow noreferrer">unicorn</a> or even <a href="https://cloud.google.com/appengine/docs/standard/" rel="nofollow noreferrer">Google App Engine Standard</a> where they can be soft started and then brought up the moment the first request comes in with downside of this is that your first requests will always be slower. (There may have been some rationale behind Kubernetes pods not having to behave this way, and I can see a lot of design changes or having to create a new type of workload for this very specific case)</p>

<p>If a pod is sitting idle it would not be consuming that many resources. You could tweak the values of your pod <a href="https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu" rel="nofollow noreferrer">resources</a> for request/limit so that you request a small number of CPUs/Memory and you set the limit to a higher number of CPUs/Memory. The upside of having a pod always running is that in theory, your first requests will never have to wait a long time to get a response.</p>
