Dev
Dev

Reputation: 13753

Resource allocation for QoS Burstable pods in Kubernetes

If limit resources are greater than request resources, K8 will assign pod to QoS Burstable

Sample configuration:

apiVersion: v1
kind: Pod
metadata:
  name: test-metadata
  namespace: demo
spec:
  containers:
  - name: test1
    image: nginx
    resources:
      limits:
        memory: "14Gi"
      requests:
        memory: "4Gi"

I don't want to use QoS Guaranteed as the workload can vary.

Upvotes: 1

Views: 498

Answers (2)

Piotr Malec
Piotr Malec

Reputation: 3647

Memory limits are not taken into consideration when scheduling pods.

Will Kubernetes always assign this pod on an instance that will have 14GB memory?

By default, this pod will be assigned to any node that meets the request for 4GB memory.

On the node side, any pod that uses more than its requested resources is subject to eviction when the node runs out of resources. In other words, Kubernetes never provides any guarantees of availability of resources beyond a Pod's requests.

Using a memory limit that exceeds the node's total memory will never be reached.

Will Kubernetes always reserve 14 GB memory for this pod? If yes, then how is it different than QoS Guaranteed class?

No, by default kubernetes will reserve the least amount of memory needed which would be 4GB as request.

Scheduler also takes into consideration scheduler configuration and scheduler policies:

Scheduler configuration allows to customize the behavior of the kube-scheduler by writing a configuration file and passing its path as a command line argument.

A scheduling Policy can be used to specify the predicates and priorities that the kube-scheduler runs to filter and score nodes, respectively.

Upvotes: 1

TheCoolDrop
TheCoolDrop

Reputation: 1066

By default Kubernetes takes only resource requests into account when trying to schedule the pods. This means that your pod will only be scheduled to some node which has at least so much resources available as requested by the pod.

To be even more precise the pod is going to be scheduled to one of the nodes such that sum of the resources requested by all the pods ( including the pod it is trying to schedule ) does not exceed the nodes allocatable resources. Here the operative words are allocatable resources.

Allocatable resources are those resources, which are available in excess of resources necesarry to operate system pods. How much of the hardware resources are reserved for system processes is configurable property of Kubernetes and is better described in their documentation of node allocatable resources

Upvotes: 1

Related Questions