1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 05:14:13 +01:00

created example yaml files out of the readme instructions with a reference to the 0.9.0 docker image. Modified the readme so the make will work since it expects a certain file structure

This commit is contained in:
Christian van der Leeden
2019-08-01 11:50:35 +02:00
parent 9e28f0b362
commit 1931bd6c1a
3 changed files with 86 additions and 0 deletions

View File

@@ -26,6 +26,8 @@ but relies on the default scheduler for that.
## Build and Run
- Checkout the repo into your $GOPATH directory under src/github.com/kubernetes-incubator/descheduler
Build descheduler:
```sh
@@ -38,6 +40,8 @@ and run descheduler:
$ ./_output/bin/descheduler --kubeconfig <path to kubeconfig> --policy-config-file <path-to-policy-file>
```
If you want more information about what descheduler is doing add `-v 1` to the command line
For more information about available options run:
```
$ ./_output/bin/descheduler --help
@@ -155,6 +159,10 @@ the policy `policy-file` is mounted as a volume from the config map.
$ kubectl create -f descheduler-job.yaml
```
### Examples
See [descheduler.yaml](examples/descheduler.yaml) and [descheduler-job.yaml](examples/descheduler-job.yaml) for a combined yaml file of the above steps.
## Policy and Strategies
Descheduler's policy is configurable and includes strategies to be enabled or disabled.

View File

@@ -0,0 +1,28 @@
---
apiVersion: batch/v1
kind: Job
metadata:
name: descheduler-job
namespace: kube-system
spec:
parallelism: 1
completions: 1
template:
metadata:
name: descheduler-pod
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ""
spec:
containers:
- name: descheduler
image: docker.io/aveshagarwal/descheduler:0.9.0
volumeMounts:
- mountPath: /policy-dir
name: policy-volume
command: ["/bin/descheduler", "--policy-config-file", "/policy-dir/policy.yaml", "-v", "1"]
restartPolicy: "Never"
serviceAccountName: descheduler-sa
volumes:
- name: policy-volume
configMap:
name: descheduler-policy-configmap

50
examples/descheduler.yaml Normal file
View File

@@ -0,0 +1,50 @@
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: descheduler-cluster-role
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "watch", "list"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "watch", "list", "delete"]
- apiGroups: [""]
resources: ["pods/eviction"]
verbs: ["create"]
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: descheduler-sa
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: descheduler-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: descheduler-cluster-role
subjects:
- kind: ServiceAccount
name: descheduler-sa
namespace: kube-system
---
kind: ConfigMap
apiVersion: v1
metadata:
name: descheduler-policy-configmap
namespace: kube-system
data:
policy.yaml: |
apiVersion: "descheduler/v1alpha1"
kind: "DeschedulerPolicy"
strategies:
"RemovePodsViolatingNodeAffinity":
enabled: true
params:
nodeAffinityType:
- "requiredDuringSchedulingIgnoredDuringExecution"