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 12 ■ Using Resource Quotas

Defining Compute Resource Quotas

The compute resource quotas limit the total compute resources used by pods in a namespace. Table 12-2

lists the compute resources supported.

Table 12-2. Supported Compute Resources

Compute Resource

cpu

limits.cpu

limits.memory

memory

requests.cpu

requests.memory

Description

The total of all cpu requests across all pods in non-terminal state cannot

exceed this setting. The container must specify a requests->CPU value if the

cpu quota is set, or pod creation could fail.

The total of all CPU limits across all pods in non-terminal state cannot

exceed this setting. The container must specify a limits->CPU value if the

limits.cpu quota is set, or pod creation could fail.

The total of all memory limits across all pods in non-terminal state cannot

exceed this setting. The container must specify a limits->memory value if

the limits.memory quota is set, or pod creation could fail.

The total of all memory requests across all pods in non-terminal state

cannot exceed this setting. The container must specify a requests->memory

value if the memory quota is set. or pod creation could fail.

Same as cpu.

Same as memory.

Create a ResourceQuota definition file compute-resource-quotas.yaml. In the spec field set hard limits

on the number of pods, total of CPU requests, total of memory requests, CPU limits, and memory limits. Set

NotBestEffort as a scope in the scopes list.

apiVersion: v1

kind: ResourceQuota

metadata:

name: compute-resource-quotas

spec:

hard:

pods: "10"

requests.cpu: "1"

requests.memory: 2Gi

limits.cpu: "2"

limits.memory: 4Gi

scopes:

-

NotBestEffort

The definition file is shown in the vi editor in Figure 12-4.

282

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

Saved successfully!

Ooh no, something went wrong!