From 2c2574fece56ab5eb70f4bcb71aac3740b2b9069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Thu, 27 Jan 2022 13:14:26 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=20Improve=20PriorityClass?= =?UTF-8?q?=20slides?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- slides/k8s/resource-limits.md | 50 +++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/slides/k8s/resource-limits.md b/slides/k8s/resource-limits.md index fc712a72..16c7757f 100644 --- a/slides/k8s/resource-limits.md +++ b/slides/k8s/resource-limits.md @@ -542,15 +542,55 @@ services.nodeports 0 0 ## Advanced quotas and PriorityClass -- Since Kubernetes 1.12, it is possible to create PriorityClass objects +- Pods can have a *priority* -- Pods can be assigned a PriorityClass +- The priority is a number from 0 to 1000000000 -- Quotas can be linked to a PriorityClass + (or even higher for system-defined priorities) -- This allows us to reserve resources for pods within a namespace +- High number = high priority = "more important" Pod -- For more details, check [this documentation page](https://kubernetes.io/docs/concepts/policy/resource-quotas/#resource-quota-per-priorityclass) +- Pods with a higher priority can *preempt* Pods with lower priority + + (= low priority pods will be *evicted* if needed) + +- Useful when mixing workloads in resource-constrained environments + +--- + +## Setting the priority of a Pod + +- Create a PriorityClass + + (or use an existing one) + +- When creating the Pod, set the field `spec.priorityClassName` + +- If the field is not set: + + - if there is a PriorityClass with `globalDefault`, it is used + + - otherwise, the default priority will be zero + +--- + +class: extra-details + +## PriorityClass and ResourceQuotas + +- A ResourceQuota can include a list of *scopes* or a *scope selector* + +- In that case, the quota will only apply to the scoped resources + +- Example: limit the resources allocated to "high priority" Pods + +- In that case, make sure that the quota is created in every Namespace + + (or use *admission configuration* to enforce it) + +- See the [resource quotas documentation][quotadocs] for details + +[quotadocs]: https://kubernetes.io/docs/concepts/policy/resource-quotas/#resource-quota-per-priorityclass ---