3.10.4. 配置 descheduler 策略
您可以配置 descheduler 使用什么策略来驱除 pod。
先决条件
- 必须具有集群管理员权限。
流程
编辑
KubeDescheduler对象:$ oc edit kubedeschedulers.operator.openshift.io cluster -n openshift-kube-descheduler-operator在
spec.strategies部分中指定一个或多个策略 。apiVersion: operator.openshift.io/v1beta1 kind: KubeDescheduler metadata: name: cluster namespace: openshift-kube-descheduler-operator spec: deschedulingIntervalSeconds: 3600 strategies: - name: "LowNodeUtilization"1 params: - name: "CPUThreshold" value: "10" - name: "MemoryThreshold" value: "20" - name: "PodsThreshold" value: "30" - name: "MemoryTargetThreshold" value: "40" - name: "CPUTargetThreshold" value: "50" - name: "PodsTargetThreshold" value: "60" - name: "NumberOfNodes" value: "3" - name: "RemoveDuplicates"2 params: - name: "ExcludeOwnerKinds" value: "ReplicaSet" - name: "RemovePodsHavingTooManyRestarts"3 params: - name: "PodRestartThreshold" value: "10" - name: "IncludingInitContainers" value: "false" - name: "RemovePodsViolatingInterPodAntiAffinity"4 - name: "PodLifeTime"5 params: - name: "MaxPodLifeTimeSeconds" value: "86400"- 1
LowNodeUtilization策略提供额外的参数,如CPUThreshold和MemoryThreshold,您可以选择进行配置。- 2
RemoveDuplicates策略提供了一个可选参数ExcludeOwnerKinds。- 3
RemovePodsHavingTooManyRestarts策略要求设置PodRestartThreshold参数。它还提供可选的InudingInitContainers参数。- 4
RemovePodsViolatingInterPodAntiAffinity、RemovePodsViolatingNodeAffinity和RemovePodsViolatingNodeTaints 策略没有可以配置的额外参数。- 5
PodLifeTime策略需要设置MaxPodLifeTimeSeconds参数。
您可以启用多个策略,且指定策略的顺序并不重要。
- 保存文件以使改变生效。