HiveBrain v1.2.0
Get Started
← Back to all entries
patternkubernetesMinor

Run more pods than node's CPU with k8s

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
withnodepodsmorethank8scpurun

Problem

Let's suppose i have 5 k8s nodes with 2 cpu on each node.

This mean i have 10 cpus.

Now let's suppose i want to deploy a very small and basic application with 20 replicas.

Is there a limitation on k8s that will allow only one pod for one cpu and reject 10/20 replicas ?

Thanks

Solution

In addition to the good answer by @therianthropie, here are useful notes to help you understand the situation better.:

  • You can set requests and limits very arbitrarily (and yes, as fractions of a CPU and very small amounts of memory).



  • Kubernetes will not do its job well if you don't get real values for these.



  • If you under-shoot your request, kubernetes will schedule a lot of apps without requesting enough resources and you'll have problems with the CPU/memory/disk, and so on.



  • If you over-shoot your request a lot, your kubernetes nodes may be doing virtually nothing.



  • Some apps are very CPU bound, some memory bound, some use virtually no resources. So, you really can't guess.



  • Prometheus is a popular tool that you can install into kubernetes with basically a single command.



  • You can chart things in grafana.



  • So, then you choose your arbitrary values, then watch the charts as you use the app, and then you can adjust them to something sane / useful so kubernetes can do its job well. You can also set alerts with something called alert manager if your values are too ridiculous (it's a good idea once you're ready).



  • Note - requests are what kubernetes allocates for your pod. Limits are the max resources your pod can spike to when it needs them. There is a general assumption that not all pods will spike in usage at once / or over a long term or else this idea would not work.

Context

StackExchange DevOps Q#11258, answer score: 1

Revisions (0)

No revisions yet.