Skip to content

Container resources

Quality of Service

Whenever specific resources such as CPU or memory are required for a pod we can define them in the resources stanza. Depending on the limits and requests values provided, different types of Quality of Service class will be used.

There are three classes available, determined by the container/pod resources object.

Best Effort

This is the default when we do not specify any limits or requests in resources

Kubernetes will not assign any resources and will give the pod a qosClass of BestEffort

Burstable

Where requests and limits are defined for at least one container within the pod. The values for requests and limits must not be equal.

resources:
  limits:
    cpu: 1
    memory: 4Gi
  requests:
    cpu: 0.5
    memory: 2Gi

Kubernetes assigns the requested resources and sets the qosClass to Burstable.

Guaranteed

Each container within a pod must have requests and limits set within their values. requests and limits for a container must be equal.

resources:
  limits:
    cpu: 1
    memory: 4Gi
  requests:
    cpu: 1
    memory: 4Gi

Kubernetes assigns the requested resources and sets the qosClass to Guaranteed

Example value files

The most convenient way to override resources when performing helm install is to use --values/-f flag and pass in a file.

Directory docs/resources/demo/ contains two example override files:

kx.yaml

provide overrides to main kx chart that encapsulates other charts in it. The top-level key is the subchart name: tp, rdb, hdb.

hdb.yaml

simpler example to override resources to hdb chart or any other chart that does not encapsulate any subcharts

helm install --values docs/resources/demo/kx-override-resources-qosClass-Guaranteed.yaml kx charts/kx

Demos