19.06.2021 Views

148422597X Kubernetes Management Design Patterns [Vohra 2017-01-29] {E559F6BB}

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 10 ■ Configuring Compute Resources

requests:

memory: "64Mi"

cpu: "100m"

limits:

memory: "64Mi"

cpu: "500m"

containers:

- name: db

image: mysql

resources:

requests:

memory: "1Gi"

cpu: "250m"

limits:

memory: "2Gi"

cpu: "250m"

The requests and limits are applied to the Docker run command when starting a container as shown in

Table 10-2.

Table 10-2. The Docker run Command Option Equivalents for Pod Spec Fields

Spec Field Docker run Command Option Description

spec.container[].resources.requests. --cpu-shares

CPU shares

cpu

spec.container[].resources.limits.cpu --cpu-quota Sets the CPU CFS (Completely

Fair Scheduler) quota

spec.container[].resources.limits.

memory

--memory flag

Memory limit

Quality of Service

Kubernetes’s Quality of Service (QoS) is a level for the resource availability. Pods or containers within a pod

that need a minimum level of resources can request guaranteed resources with the spec.container[].

resources.requests.cpu and spec.container[].resources.requests.memory fields. Pods that do not

need guaranteed resources can omit specifying the request levels. Three QoS classes are provided for

containers for each of the resource types. The QoS classes are based on requests and limits and are as shown

in Table 10-3 in decreasing order of priority.

242

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!