Skip to content

Commit a42709b

Browse files
committed
added k8s example
1 parent 623050e commit a42709b

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ Replace variables below to use the Docker version of this tool
113113
* `{YOUR_GRAFANA_URL}`: Your Grafana site `URL`.
114114
* `{YOUR_BACKUP_FOLDER_ON_THE_HOST}`: The `backup folder` on the Grafana host machine.
115115

116+
## Kubernetes
117+
Check out the CronJob in [deploy](deploy) for a simple example of how grafana-backup-tool
118+
can be ran within a Kubernetes environment
119+
116120
### Backup
117121

118122
If you decide to use a volume (-v) then you'll need to create the volume first with 1337 uid/gid ownership first, example:
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
apiVersion: v1
3+
kind: Namespace
4+
metadata:
5+
name: grafana-backup-tool
6+
---
7+
apiVersion: v1
8+
kind: ConfigMap
9+
metadata:
10+
name: grafana-backup-tool
11+
namespace: grafana-backup-tool
12+
data:
13+
GRAFANA_URL: "http://grafana.grafana.svc.cluster.local:80"
14+
GRAFANA_TOKEN: "{YOUR_GRAFANA_TOKEN}"
15+
GRAFANA_ADMIN_ACCOUNT: "backup"
16+
GRAFANA_ADMIN_PASSWORD: "{YOUR_GRAFANA_ADMIN_PASSWORD}"
17+
AWS_ENDPOINT_URL: "http://gitlab-minio-svc.gitlab.svc.cluster.local:9000"
18+
AWS_S3_BUCKET_NAME: "grafana-backup"
19+
AWS_S3_BUCKET_KEY: "daily"
20+
AWS_DEFAULT_REGION: "us-east-1"
21+
AWS_ACCESS_KEY_ID: "{YOUR_AWS_ACCESS_KEY_ID}"
22+
AWS_SECRET_ACCESS_KEY: "{YOUR_AWS_SECRET_ACCESS_KEY}"
23+
---
24+
# Run grafana-backup-tool daily and store backups in an S3
25+
# compatible object storage such as minio
26+
apiVersion: batch/v1
27+
kind: CronJob
28+
metadata:
29+
name: grafana-backup-tool
30+
namespace: grafana-backup-tool
31+
labels:
32+
app: grafana-backup-tool
33+
spec:
34+
schedule: "0 4 * * *"
35+
jobTemplate:
36+
metadata:
37+
labels:
38+
app: grafana-backup-tool
39+
spec:
40+
template:
41+
spec:
42+
restartPolicy: "Never"
43+
containers:
44+
- name: grafana-backup-tool
45+
image: "ysde/docker-grafana-backup-tool:1.2.3"
46+
imagePullPolicy: Always
47+
envFrom:
48+
- configMapRef:
49+
name: grafana-backup-tool

0 commit comments

Comments
 (0)