<p>First of all, I'm pretty new to Kubernetes, and the amount of different architectures and solutions out there make it very difficult to find a good source to fit my specific needs.</p>

<p>So I have a cluster that runs many clones of the same application, which is a stateless heavy-load python application. I enable vertical auto-scaling to add more nodes in peak times, which should help dealing with larger traffic effectively. The thing I'm not sure about is the pod allocation strategy.</p>

<p>What I thought to do is to keep maximum number of idle pods running in my node, waiting for requests to start operate.
Is this approach even conceptually right/solid? Is it "in the spirit" of Kubernetes, or am I misusing it somehow?</p>

<p>The reason I think to avoid pod auto-scaling is because it's hard to determine a rule by which to perform the scaling, as well as I don't see the benefits, since each pod has basically two states - idle or full-power on.</p>

Itay Davidson
<p>You can use cluster autoscaler to have some resources in idle if you want to avoid application errors in a peak time, for example.</p>

<p>The cluster autoscaler will increase your cluster size based on your resources usage, but this scaling isn't very quickly and sometimes it could take some minutes, you must have this in you mind when configure cluster autoscaler.</p>

<p>If you already know you peaks times, so you could schedule to increase the nodes number on the cluster to waiting the peak time.</p>

<p>Autoscaling is always complex to set-up in the beginning because your never know what will happens with your customers. There is no a magical formula to do this, my advice for you is to test all options that you have and try to find what approach best fits for your workload.</p>

<p>Here you can see how to configure cluster autoscaler in the most commons providers:</p>

<p><a href="https://kubernetes.io/docs/concepts/cluster-administration/cluster-management/" rel="nofollow noreferrer">Auto scaler GCE</a></p>

<p><a href="https://cloud.google.com/container-engine/docs/cluster-autoscaler" rel="nofollow noreferrer">Autoscaler GKE</a></p>

<p><a href="https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/aws/README.md" rel="nofollow noreferrer">Autoscaler AWS</a></p>

<p><a href="https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/azure/README.md" rel="nofollow noreferrer">Autoscaler Azure</a></p>

<p><a href="https://medium.com/kubecost/understanding-kubernetes-cluster-autoscaling-675099a1db92" rel="nofollow noreferrer">Here</a> there's a that article that could help you.</p>

<p>About pods resource allocation, the <a href="https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/#if-you-do-not-specify-a-cpu-limit" rel="nofollow noreferrer">documentation</a> mention:</p>

<blockquote>
  <p>If you do not specify a CPU limit for a Container, then one of these situations applies:
  -   The Container has no upper bound on the CPU resources it can use. The Container could use all of the CPU resources available on the Node where it is running.
  -   The Container is running in a namespace that has a default CPU limit, and the Container is automatically assigned the default limit. Cluster administrators can use a  <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#limitrange-v1-core/" rel="nofollow noreferrer">LimitRange</a>  to specify a default value for the CPU limit.</p>
</blockquote>

<p>The containers will not allocate resources if it doesn't needed, but at moment they request for resources all resources on your node will be allocated for the pod.</p>

<p>You could create replicas of you container if you want balance the workload in your application, it make sense only if you limited resource of your container or if you know that each container/application support a limited number of requests.</p>
