Skip to content

Commit 0aea3df

Browse files
support disable init-job
1 parent fec04e4 commit 0aea3df

File tree

3 files changed

+106
-1
lines changed

3 files changed

+106
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# kube-scheduler configuration
2+
3+
If kube-scheduler in your cluster is [static pod](https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/), Open-Local will run a Job in every master node to edit your /etc/kubernetes/manifests/kube-scheduler.yaml file by default, you can see it in [init-job](./../../helm/templates/init-job.yaml) file.
4+
5+
And you can also configure your kube-scheduler manually, especially when kube-scheduler in the cluster are not static pod.
6+
7+
Set .extender.init_job to false in [values.yaml](../../helm/values.yaml) before install Open-Local, this will not run init-job.
8+
9+
Create a file, name it kube-scheduler-configuration.yaml, and put it in /etc/kubernetes/ path of every master node.
10+
11+
```yaml
12+
apiVersion: kubescheduler.config.k8s.io/v1beta1
13+
kind: KubeSchedulerConfiguration
14+
clientConnection:
15+
kubeconfig: /etc/kubernetes/scheduler.conf # your kubeconfig filepath
16+
extenders:
17+
- urlPrefix: http://open-local-scheduler-extender.kube-system:23000/scheduler
18+
filterVerb: predicates
19+
prioritizeVerb: priorities
20+
weight: 10
21+
ignorable: true
22+
nodeCacheCapable: true
23+
```
24+
25+
If your kube-scheduler is static pod, configure your kube-scheduler file like this:
26+
27+
```yaml
28+
apiVersion: v1
29+
kind: Pod
30+
metadata:
31+
creationTimestamp: null
32+
labels:
33+
component: kube-scheduler
34+
tier: control-plane
35+
name: kube-scheduler
36+
namespace: kube-system
37+
spec:
38+
containers:
39+
- command:
40+
- kube-scheduler
41+
- --address=0.0.0.0
42+
- --authentication-kubeconfig=/etc/kubernetes/scheduler.conf
43+
- --authorization-kubeconfig=/etc/kubernetes/scheduler.conf
44+
- --bind-address=0.0.0.0
45+
- --feature-gates=TTLAfterFinished=true,EphemeralContainers=true
46+
- --kubeconfig=/etc/kubernetes/scheduler.conf
47+
- --leader-elect=true
48+
- --port=10251
49+
- --profiling=false
50+
- --config=/etc/kubernetes/kube-scheduler-configuration.yaml # add --config option
51+
image: sea.hub:5000/oecp/kube-scheduler:v1.20.4-aliyun.1
52+
imagePullPolicy: IfNotPresent
53+
livenessProbe:
54+
failureThreshold: 8
55+
httpGet:
56+
path: /healthz
57+
port: 10259
58+
scheme: HTTPS
59+
initialDelaySeconds: 10
60+
periodSeconds: 10
61+
timeoutSeconds: 15
62+
name: kube-scheduler
63+
resources:
64+
requests:
65+
cpu: 100m
66+
startupProbe:
67+
failureThreshold: 24
68+
httpGet:
69+
path: /healthz
70+
port: 10259
71+
scheme: HTTPS
72+
initialDelaySeconds: 10
73+
periodSeconds: 10
74+
timeoutSeconds: 15
75+
volumeMounts:
76+
- mountPath: /etc/kubernetes/kube-scheduler-configuration.yaml # mount this file into the container
77+
name: scheduler-policy-config
78+
readOnly: true
79+
- mountPath: /etc/kubernetes/scheduler.conf
80+
name: kubeconfig
81+
readOnly: true
82+
- mountPath: /etc/localtime
83+
name: localtime
84+
readOnly: true
85+
hostNetwork: true
86+
dnsPolicy: ClusterFirstWithHostNet
87+
priorityClassName: system-node-critical
88+
volumes:
89+
- hostPath:
90+
path: /etc/kubernetes/kube-scheduler-configuration.yaml
91+
type: File
92+
name: scheduler-policy-config # this is kube-scheduler-configuration.yaml that we created before
93+
- hostPath:
94+
path: /etc/kubernetes/scheduler.conf
95+
type: FileOrCreate
96+
name: kubeconfig
97+
- hostPath:
98+
path: /etc/localtime
99+
type: File
100+
name: localtime
101+
```

helm/templates/init-job.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if .Values.extender.init_job }}
12
kind: Job
23
apiVersion: batch/v1
34
metadata:
@@ -91,4 +92,5 @@ spec:
9192
- name: kube-dir
9293
hostPath:
9394
path: /etc/kubernetes/
94-
type: DirectoryOrCreate
95+
type: DirectoryOrCreate
96+
{{- end }}

helm/values.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ extender:
3232
strategy: spread
3333
# scheduler extender http port
3434
port: 23000
35+
# you can also configure your kube-scheduler manually, see docs/user-guide/kube-scheduler-configuration.md to get more details
36+
init_job: true
3537
storageclass:
3638
lvm:
3739
name: open-local-lvm

0 commit comments

Comments
 (0)