kubernetes-sigs / descheduler

Descheduler for Kubernetes
https://sigs.k8s.io/descheduler
Apache License 2.0
4.24k stars 645 forks source link

PodLifeTime: provide option to add unpredictability factor when descheduling pod after certain amount of time #1271

Open miqm opened 8 months ago

miqm commented 8 months ago

Is your feature request related to a problem? Please describe.

If you deploy a service with several replicas, descheduler with PodLifeTime plugin will evict them close to each other - i.e. deployment at 1pm with maxPodLifeTimeSeconds set to 24h will mean that every day at 1pm pods will restart. Although eviction is subject to PDBs, having ability to provide some randomness in eviction time could be beneficial.

Describe the solution you'd like

I'd like to provide additional time range and probability factor that descheduler will use to determine if pod eviction should occur. maxPodLifeTimeSeconds would be the earliest time that pod can be evicted. After that time, two other parameters would need to be considered (names are just my proposal, feel free to adjust): extendedPodLifeTimeEvictionProbability - float 0-1, default to 0.33 - parameter determining the chance that pod is going to be evicted after maxPodLifeTimeSeconds passes. Every time descheduler runs, chance of eviction would be calculated (using rand.Float64 and checking if value is less or equal to this option). Setting this to 1 would mean that pod will be evicted as soon as maxPodLifeTimeSeconds passes, on the first run. extendedPodLifeTimeSeconds - int, default 0. the additional time that would be added to the maxPodLifeTimeSeconds during which there will be a chance (according to extendedPodLifeTimeEvictionProbability option) that pod is evicted on descheduler run. Once this time passes - pod must be evicted. With default setting to 0, we would maintain current behaviour.

Describe alternatives you've considered

What version of descheduler are you using?

descheduler version: v0.28.0

Additional context

k8s-triage-robot commented 5 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 4 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

miqm commented 4 months ago

/remove-lifecycle rotten

k8s-triage-robot commented 1 month ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

miqm commented 1 month ago

/remove-lifecycle stale