Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug 1814547: Rebase upstream 1.18 #30

Merged
merged 25 commits into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b019a58
Add damemi to approvers
damemi May 6, 2020
fa335c7
Switch PodsHavingTooManyRestarts params to pointer
damemi May 6, 2020
635348e
Fix readme
lixiang233 May 7, 2020
beae282
Merge pull request #277 from damemi/damemi-approvers
k8s-ci-robot May 7, 2020
211f394
Merge pull request #276 from damemi/toomanyrestarts-pointer
k8s-ci-robot May 7, 2020
31c7855
Merge pull request #278 from lixiang233/fix_readme
k8s-ci-robot May 7, 2020
423ee35
Add New PodLifeTime Strategy
seanmalloy Apr 24, 2020
668d727
Add VS Code File To .gitignore
seanmalloy May 3, 2020
643cd47
Add initial production use cases section to user guide
seanmalloy May 8, 2020
c01cfcf
Merge pull request #274 from KohlsTechnology/pod-lifetime-strategy
k8s-ci-robot May 8, 2020
741b35e
Update to k8s 1.18.2 dependencies
damemi May 12, 2020
eec1104
React to 1.18 by adding contexts to client calls
damemi May 12, 2020
c20a595
Update travis.yml with new k8s version and updated kind version
damemi May 12, 2020
d7e9305
Merge pull request #280 from damemi/k8s-1.18
k8s-ci-robot May 12, 2020
731d3c8
Resolve merge conflicts
damemi May 12, 2020
4941f6a
Update Travis CI build matrix with latest k8s point releases
seanmalloy May 13, 2020
25336da
Merge pull request #281 from KohlsTechnology/update-travis-ci
k8s-ci-robot May 13, 2020
4819ab9
Add namespace to pod eviction log messages
seanmalloy May 12, 2020
cff9842
Log an error when EvictPod method returns a non-nil error
seanmalloy May 12, 2020
7039b6c
Refactor function EvictPod to only return an error
seanmalloy May 14, 2020
55afde6
Remove line break in log message from PodLifeTime strategy
seanmalloy May 14, 2020
04efe65
Merge pull request #279 from KohlsTechnology/eviction-logs
k8s-ci-robot May 14, 2020
c6ff87d
Consider pod image in duplicates strategy
damemi May 1, 2020
34550d4
Merge pull request #275 from damemi/image-in-duplicates
k8s-ci-robot May 15, 2020
e396094
travis.yml merge conflict
damemi May 15, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ _output/
_tmp/
vendordiff.patch
.idea/

*.code-workspace
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ See the [user guide](docs/user-guide.md) in the `/docs` directory.
## Policy and Strategies

Descheduler's policy is configurable and includes strategies that can be enabled or disabled.
Five strategies `RemoveDuplicates`, `LowNodeUtilization`, `RemovePodsViolatingInterPodAntiAffinity`,
`RemovePodsViolatingNodeAffinity`, and `RemovePodsViolatingNodeTaints` are currently implemented.
As part of the policy, the parameters associated with the strategies can be configured too.
Seven strategies `RemoveDuplicates`, `LowNodeUtilization`, `RemovePodsViolatingInterPodAntiAffinity`,
`RemovePodsViolatingNodeAffinity`, `RemovePodsViolatingNodeTaints`, `RemovePodsHavingTooManyRestarts`, and `PodLifeTime`
are currently implemented. As part of the policy, the parameters associated with the strategies can be configured too.
By default, all strategies are enabled.

### RemoveDuplicates
Expand All @@ -66,15 +66,21 @@ Replication Controller (RC), Deployment, or Job running on the same node. If the
those duplicate pods are evicted for better spreading of pods in a cluster. This issue could happen
if some nodes went down due to whatever reasons, and pods on them were moved to other nodes leading to
more than one pod associated with a RS or RC, for example, running on the same node. Once the failed nodes
are ready again, this strategy could be enabled to evict those duplicate pods. Currently, there are no
parameters associated with this strategy. To disable this strategy, the policy should look like:
are ready again, this strategy could be enabled to evict those duplicate pods.

It provides one optional parameter, `ExcludeOwnerKinds`, which is a list of OwnerRef `Kind`s. If a pod
has any of these `Kind`s listed as an `OwnerRef`, that pod will not be considered for eviction.

```
apiVersion: "descheduler/v1alpha1"
kind: "DeschedulerPolicy"
strategies:
"RemoveDuplicates":
enabled: false
enabled: true
params:
removeDuplicates:
excludeOwnerKinds:
- "ReplicaSet"
```

### LowNodeUtilization
Expand Down Expand Up @@ -198,6 +204,21 @@ strategies:
includingInitContainers: true
```

### PodLifeTime

This strategy evicts pods that are older than `.strategies.PodLifeTime.params.maxPodLifeTimeSeconds` The policy
file should look like:

````
apiVersion: "descheduler/v1alpha1"
kind: "DeschedulerPolicy"
strategies:
"PodLifeTime":
enabled: true
params:
maxPodLifeTimeSeconds: 86400
````

## Pod Evictions

When the descheduler decides to evict pods from a node, it employs the following general mechanism:
Expand Down Expand Up @@ -265,7 +286,6 @@ Learn how to engage with the Kubernetes community on the [community page](http:/
This roadmap is not in any particular order.

* Consideration of pod affinity
* Strategy to consider pod life time
* Strategy to consider number of pending pods
* Integration with cluster autoscaler
* Integration with metrics providers for obtaining real load metrics
Expand Down
45 changes: 44 additions & 1 deletion docs/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ Starting with descheduler release v0.10.0 container images are available in thes
* `eu.gcr.io/k8s-artifacts-prod/descheduler/descheduler`
* `us.gcr.io/k8s-artifacts-prod/descheduler/descheduler`

## Policy Configuration Examples
The [examples](https://github.com/kubernetes-sigs/descheduler/tree/master/examples) directory has descheduler policy configuration examples.

## CLI Options
The descheduler has many CLI options that can be used to override its default behavior.
```
descheduler --help
Expand Down Expand Up @@ -44,4 +46,45 @@ Flags:
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging

Use "descheduler [command] --help" for more information about a command.
```
```

## Production Use Cases
This section contains descriptions of real world production use cases.

### Balance Cluster By Pod Age
When initially migrating applications from a static virtual machine infrastructure to a cloud native k8s
infrastructure there can be a tendency to treat application pods like static virtual machines. One approach
to help prevent developers and operators from treating pods like virtual machines is to ensure that pods
only run for a fixed amount
of time.

The `PodLifeTime` strategy can be used to ensure that old pods are evicted. It is recommended to create a
[pod disruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) for each
application to ensure application availability.
```
descheduler -v=3 --evict-local-storage-pods --policy-config-file=pod-life-time.yml
```

This policy configuration file ensures that pods created more than 7 days ago are evicted.
```
---
apiVersion: "descheduler/v1alpha1"
kind: "DeschedulerPolicy"
strategies:
"LowNodeUtilization":
enabled: false
"RemoveDuplicates":
enabled: false
"RemovePodsViolatingInterPodAntiAffinity":
enabled: false
"RemovePodsViolatingNodeAffinity":
enabled: false
"RemovePodsViolatingNodeTaints":
enabled: false
"RemovePodsHavingTooManyRestarts":
enabled: false
"PodLifeTime":
enabled: true
params:
maxPodLifeTimeSeconds: 604800 # pods run for a maximum of 7 days
```
20 changes: 20 additions & 0 deletions examples/pod-life-time.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
apiVersion: "descheduler/v1alpha1"
kind: "DeschedulerPolicy"
strategies:
"LowNodeUtilization":
enabled: false
"RemoveDuplicates":
enabled: false
"RemovePodsViolatingInterPodAntiAffinity":
enabled: false
"RemovePodsViolatingNodeAffinity":
enabled: false
"RemovePodsViolatingNodeTaints":
enabled: false
"RemovePodsHavingTooManyRestarts":
enabled: false
"PodLifeTime":
enabled: true
params:
maxPodLifeTimeSeconds: 604800 # 7 days
13 changes: 5 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ module sigs.k8s.io/descheduler
go 1.13

require (
github.com/gogo/protobuf v1.3.1 // indirect
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.5
k8s.io/api v0.17.0
k8s.io/apimachinery v0.17.3-beta.0
k8s.io/apiserver v0.17.0
k8s.io/client-go v0.17.0
k8s.io/component-base v0.17.0
k8s.io/api v0.18.2
k8s.io/apimachinery v0.18.2
k8s.io/apiserver v0.18.2
k8s.io/client-go v0.18.2
k8s.io/component-base v0.18.2
k8s.io/klog v1.0.0
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)
Loading