What is a simple explanation to resource allocation and definitions in kubernetes? What does it mean to allocate "1000m" CPU units and 1024Mi off memory?
(tried to write it in simpler language than the official docs)
CPU
In Kubernetes each CPU core is allocated in units of one "milicore" meaning one Virtual Core (on a virtual machine) can be divided into 1000 shares of 1 milicore. Allocating 1000 milicores will give a pod one full CPU. Giving more will require the code in the pod to able to utilize more than one core.
Memory
Very simple. Each Megabyte you allocate is reserved for the pod.
Requests
Minimal resources that are guaranteed to be given to the pod. If there are not enough resources to start a pod on any node it will remain in "Pending" state.
Limits
CPU Limit Will cause the the pod to throttle down when hitting the limit.
Memory Limit When a pod utilizes all of it's memory and asks for more than the limit it will considered a memory leak and the pod will get restarted.
Target (defined in the Horizontal Pod Autoscaler)
Can be applied to CPU, Memory and other custom metrics (more complicated to define.
It's might be a good idea to set resources for a pod in sizes of A B and C where: A < B < C. With requests = A, Target = B and Limits = C. Just remember that a fully loaded node might prevent pods from reaching their "target" and not never scale up.