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
参数。
您可以启用多个策略,且指定策略的顺序并不重要。
- 保存文件以使改变生效。