From cb4cbbe34e6e164a253804744713f600fc3c40d6 Mon Sep 17 00:00:00 2001 From: Harry Zhang Date: Fri, 20 Apr 2018 15:20:38 -0700 Subject: [PATCH] Seperate priority and preemption --- .../configuration/pod-priority-preemption.md | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/docs/concepts/configuration/pod-priority-preemption.md b/docs/concepts/configuration/pod-priority-preemption.md index dc482b11e1681..023c788bd6bea 100644 --- a/docs/concepts/configuration/pod-priority-preemption.md +++ b/docs/concepts/configuration/pod-priority-preemption.md @@ -19,8 +19,8 @@ order of Pods and out-of-resource eviction ordering on the Node. {% capture body %} -## How to use priority and preemption -To use priority and preemption in Kubernetes 1.8 and later, follow these steps: +## How to use priority +To use priority in Kubernetes 1.8 and later, follow these steps: 1. Enable the feature. @@ -32,9 +32,9 @@ Of course you do not need to create the Pods directly; normally you would add The following sections provide more information about these steps. -## Enabling priority and preemption +## Enabling priority -Pod priority and preemption is disabled by default in Kubernetes 1.8. +Pod priority is disabled by default in Kubernetes 1.8. To enable the feature, set this command-line flag for the API server, scheduler and kubelet: ``` @@ -51,6 +51,30 @@ Also enable scheduling.k8s.io/v1alpha1 API and Priority [admission controller](/ After the feature is enabled, you can create [PriorityClasses](#priorityclass) and create Pods with [`priorityClassName`](#pod-priority) set. + +## How to use preemption + +Before Kubernetes 1.11, preemption is bound with `PodPriority` feature gate and will be automatically enabled with priority. + +But in Kubernetes 1.11 and later, preemption is controlled by a kube-scheduler flag `disablePreemption` which is `false` by default. +Please note, although preemption is enabled by default, it will be ignored if priority feature is disabled. + +If you want to use priority without enabling preemption, you can set `disablePreemption` to `true` and enable `PodPriority` feature +at the same time, here's a sample configuration: + +```yaml +apiVersion: componentconfig/v1alpha1 +kind: KubeSchedulerConfiguration +algorithmSource: + provider: DefaultProvider + +... + +disablePreemption: true + +``` + + If you try the feature and then decide to disable it, you must remove the PodPriority command-line flag or set it to false, and then restart the API server and scheduler. After the feature is disabled, the existing Pods keep their priority