$ oc edit kubedeschedulers.operator.openshift.io cluster -n openshift-kube-descheduler-operator
You can run the descheduler in OpenShift Container Platform by installing the Kube Descheduler Operator and setting the desired profiles and other customizations.
The descheduler is not available by default. To enable the descheduler, you must install the Kube Descheduler Operator from OperatorHub and enable one or more descheduler profiles.
By default, the descheduler runs in predictive mode, which means that it only simulates pod evictions. You must change the mode to automatic for the descheduler to perform the pod evictions.
If you have enabled hosted control planes in your cluster, set a custom priority threshold to lower the chance that pods in the hosted control plane namespaces are evicted. Set the priority threshold class name to |
You are logged in to OpenShift Container Platform as a user with the cluster-admin
role.
Access to the OpenShift Container Platform web console.
Log in to the OpenShift Container Platform web console.
Create the required namespace for the Kube Descheduler Operator.
Navigate to Administration → Namespaces and click Create Namespace.
Enter openshift-kube-descheduler-operator
in the Name field, enter openshift.io/cluster-monitoring=true
in the Labels field to enable descheduler metrics, and click Create.
Install the Kube Descheduler Operator.
Navigate to Operators → OperatorHub.
Type Kube Descheduler Operator into the filter box.
Select the Kube Descheduler Operator and click Install.
On the Install Operator page, select A specific namespace on the cluster. Select openshift-kube-descheduler-operator from the drop-down menu.
Adjust the values for the Update Channel and Approval Strategy to the desired values.
Click Install.
Create a descheduler instance.
From the Operators → Installed Operators page, click the Kube Descheduler Operator.
Select the Kube Descheduler tab and click Create KubeDescheduler.
Edit the settings as necessary.
To evict pods instead of simulating the evictions, change the Mode field to Automatic.
You can configure which profiles the descheduler uses to evict pods.
You are logged in to OpenShift Container Platform as a user with the cluster-admin
role.
Edit the KubeDescheduler
object:
$ oc edit kubedeschedulers.operator.openshift.io cluster -n openshift-kube-descheduler-operator
Specify one or more profiles in the spec.profiles
section.
apiVersion: operator.openshift.io/v1
kind: KubeDescheduler
metadata:
name: cluster
namespace: openshift-kube-descheduler-operator
spec:
deschedulingIntervalSeconds: 3600
logLevel: Normal
managementState: Managed
operatorLogLevel: Normal
mode: Predictive (1)
profileCustomizations:
namespaces: (2)
excluded:
- my-namespace
podLifetime: 48h (3)
thresholdPriorityClassName: my-priority-class-name (4)
profiles: (5)
- AffinityAndTaints
- TopologyAndDuplicates (6)
- LifecycleAndUtilization
- EvictPodsWithLocalStorage
- EvictPodsWithPVC
1 | Optional: By default, the descheduler does not evict pods. To evict pods, set mode to Automatic . |
2 | Optional: Set a list of user-created namespaces to include or exclude from descheduler operations. Use excluded to set a list of namespaces to exclude or use included to set a list of namespaces to include. Note that protected namespaces (openshift-* , kube-system , hypershift ) are excluded by default. |
3 | Optional: Enable a custom pod lifetime value for the LifecycleAndUtilization profile. Valid units are s , m , or h . The default pod lifetime is 24 hours. |
4 | Optional: Specify a priority threshold to consider pods for eviction only if their priority is lower than the specified level. Use the thresholdPriority field to set a numerical priority threshold (for example, 10000 ) or use the thresholdPriorityClassName field to specify a certain priority class name (for example, my-priority-class-name ). If you specify a priority class name, it must already exist or the descheduler will throw an error. Do not set both thresholdPriority and thresholdPriorityClassName . |
5 | Add one or more profiles to enable. Available profiles: AffinityAndTaints , TopologyAndDuplicates , LifecycleAndUtilization , SoftTopologyAndDuplicates , EvictPodsWithLocalStorage , and EvictPodsWithPVC . |
6 | Do not enable both TopologyAndDuplicates and SoftTopologyAndDuplicates . Enabling both results in a conflict. |
You can enable multiple profiles; the order that the profiles are specified in is not important.
Save the file to apply the changes.
You can configure the amount of time between descheduler runs. The default is 3600 seconds (one hour).
You are logged in to OpenShift Container Platform as a user with the cluster-admin
role.
Edit the KubeDescheduler
object:
$ oc edit kubedeschedulers.operator.openshift.io cluster -n openshift-kube-descheduler-operator
Update the deschedulingIntervalSeconds
field to the desired value:
apiVersion: operator.openshift.io/v1
kind: KubeDescheduler
metadata:
name: cluster
namespace: openshift-kube-descheduler-operator
spec:
deschedulingIntervalSeconds: 3600 (1)
...
1 | Set the number of seconds between descheduler runs. A value of 0 in this field runs the descheduler once and exits. |
Save the file to apply the changes.