forked from sj14/kubedump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cronjob.yaml
103 lines (103 loc) · 2.39 KB
/
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
apiVersion: v1
kind: Namespace
metadata:
name: kubedump
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: kubedump
name: kubedump
namespace: kubedump
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kubedump
rules: # limit the groups/resources according to your (security) needs
- apiGroups:
- "*"
resources:
- "*"
verbs: ["list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubedump
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubedump
subjects:
- kind: ServiceAccount
name: kubedump
namespace: kubedump
---
apiVersion: v1
kind: ConfigMap
metadata:
name: kubedump-config
namespace: kubedump
data:
# adjust settings as desired
CONFIG: "" # empty -> in-cluster config
DIR: "/dump"
VERBOSITY: "3"
IGNORE_NAMESPACES: kube-system,kube-public,kube-node-lease
IGNORE_RESOURCES: events
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: kubedump
namespace: kubedump
spec:
schedule: "@daily"
concurrencyPolicy: Replace
jobTemplate:
metadata:
name: kubedump
namespace: kubedump
spec:
template:
spec:
serviceAccountName: kubedump
initContainers:
- image: ghcr.io/sj14/kubedump:latest # pin a fixed version
name: kubedump
resources:
requests:
memory: "64Mi"
cpu: "10m"
limits:
memory: "256Mi"
cpu: "500m"
envFrom:
- configMapRef:
name: kubedump-config
volumeMounts:
- mountPath: /dump
name: dump-volume
containers:
- image: alpine # adjust the container with something you want to do, e.g. backup to s3
name: alpine
command:
- sleep
- infinity
resources:
requests:
memory: "64Mi"
cpu: "10m"
limits:
memory: "256Mi"
cpu: "500m"
volumeMounts:
- mountPath: /dump
name: dump-volume
restartPolicy: OnFailure
volumes:
- name: dump-volume
emptyDir:
sizeLimit: 500Mi