Replace launch script with kubernetes resource
authorMartin Pitt <martin@piware.de>
Fri, 21 May 2021 06:56:59 +0000 (08:56 +0200)
committerMartin Pitt <martin@piware.de>
Fri, 21 May 2021 08:01:23 +0000 (10:01 +0200)
This can be deployed locally with

    podman play kube learn-metrics.yaml

Generated with

    podman generate kube learn-metrics > learn-metrics.yaml

and heavy editing/manual cleanup.

launch.sh [deleted file]
learn-metrics.yaml [new file with mode: 0644]

diff --git a/launch.sh b/launch.sh
deleted file mode 100755 (executable)
index 14eaeec..0000000
--- a/launch.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-set -eux
-podman run -d --pod new:learn-metrics --name metrics-grafana \
-    -p 3000:3000 -p 3001:9090 \
-    -e GF_SECURITY_ADMIN_PASSWORD=foobar \
-    -v ./conf-grafana/datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml:ro \
-    quay.io/bitnami/grafana
-
-podman run -d --pod learn-metrics --name metrics-prometheus docker.io/prom/prometheus
diff --git a/learn-metrics.yaml b/learn-metrics.yaml
new file mode 100644 (file)
index 0000000..4d76cf9
--- /dev/null
@@ -0,0 +1,34 @@
+apiVersion: v1
+kind: Pod
+metadata:
+  labels:
+    app: learn-metrics
+  name: learn-metrics
+spec:
+  containers:
+  - image: quay.io/bitnami/grafana:latest
+    name: grafana
+    env:
+    - name: GF_SECURITY_ADMIN_PASSWORD
+      value: foobar
+    ports:
+    - containerPort: 3000
+      hostPort: 3000
+      protocol: TCP
+    volumeMounts:
+    - name: grafana-datasource
+      mountPath: /etc/grafana/provisioning/datasources/datasource.yaml
+      readOnly: true
+
+  - image: docker.io/prom/prometheus:latest
+    name: prometheus
+    ports:
+    - containerPort: 9090
+      hostPort: 3001
+      protocol: TCP
+
+  volumes:
+  - hostPath:
+      path: ./conf-grafana/datasource.yaml
+      type: File
+    name: grafana-datasource