-
Notifications
You must be signed in to change notification settings - Fork 9
/
etcd-defrag-cronjob.yaml
61 lines (61 loc) · 1.94 KB
/
etcd-defrag-cronjob.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
apiVersion: batch/v1
kind: CronJob
metadata:
name: etcd-defrag
namespace: kube-system
spec:
schedule: "14 9 * * 1-5"
jobTemplate:
spec:
template:
spec:
containers:
- name: etcd-defrag
image: ghcr.io/ahrtr/etcd-defrag:v0.18.0 # Please replace the version with the latest version.
args:
- --endpoints=https://127.0.0.1:2379
- --cacert=/ca.crt
- --cert=/client.crt
- --key=/client.key
- --cluster
- --defrag-rule
- "dbQuotaUsage > 0.8 || dbSize - dbSizeInUse > 200*1024*1024"
volumeMounts:
- mountPath: /ca.crt
name: ca-crt
readOnly: true
- mountPath: /client.crt
name: client-crt
readOnly: true
- mountPath: /client.key
name: client-key
readOnly: true
volumes:
- name: ca-crt
hostPath:
path: /etc/kubernetes/pki/etcd/ca.crt
type: File
- name: client-crt
hostPath:
path: /etc/kubernetes/pki/apiserver-etcd-client.crt
type: File
- name: client-key
hostPath:
path: /etc/kubernetes/pki/apiserver-etcd-client.key
type: File
restartPolicy: OnFailure
hostNetwork: true # needed in order to reach the etcd server with 127.0.0.1:2379
securityContext:
runAsUser: 0
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane
- effect: NoExecute
operator: Exists
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: Exists