From 03919f11f11d3bec15eaf6238b61181b6af96935 Mon Sep 17 00:00:00 2001 From: Oscar Beaumont Date: Mon, 19 Jul 2021 13:54:58 +0800 Subject: [PATCH] changed databases to StatefulSet --- kubernetes/plausible-db.yaml | 34 ++++++++++++++--------------- kubernetes/plausible-events-db.yaml | 34 ++++++++++++++--------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/kubernetes/plausible-db.yaml b/kubernetes/plausible-db.yaml index ce5ecac..bcf0aa0 100644 --- a/kubernetes/plausible-db.yaml +++ b/kubernetes/plausible-db.yaml @@ -18,19 +18,8 @@ spec: app.kubernetes.io/component: database app.kubernetes.io/part-of: plausible --- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: plausible-db-pvc -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 5Gi ---- apiVersion: apps/v1 -kind: Deployment +kind: StatefulSet metadata: name: plausible-db labels: @@ -39,6 +28,7 @@ metadata: app.kubernetes.io/part-of: plausible spec: replicas: 1 + serviceName: plausible-db selector: matchLabels: app.kubernetes.io/name: postgres @@ -52,10 +42,6 @@ spec: app.kubernetes.io/part-of: plausible spec: restartPolicy: Always - volumes: - - name: pgdata - persistentVolumeClaim: - claimName: plausible-db-pvc containers: - name: plausible-db image: postgres:latest @@ -63,7 +49,7 @@ spec: ports: - containerPort: 5432 volumeMounts: - - name: pgdata + - name: data mountPath: /var/lib/postgresql/data env: - name: POSTGRES_DB @@ -107,3 +93,17 @@ spec: initialDelaySeconds: 30 failureThreshold: 3 periodSeconds: 10 + volumeClaimTemplates: + - metadata: + name: data + labels: + app.kubernetes.io/name: postgres + app.kubernetes.io/component: database + app.kubernetes.io/part-of: plausible + spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 128Mi + limits: + storage: 15Gi diff --git a/kubernetes/plausible-events-db.yaml b/kubernetes/plausible-events-db.yaml index 001f495..bd43865 100644 --- a/kubernetes/plausible-events-db.yaml +++ b/kubernetes/plausible-events-db.yaml @@ -18,19 +18,8 @@ spec: app.kubernetes.io/component: database app.kubernetes.io/part-of: plausible --- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: plausible-events-db-pvc -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 5Gi ---- apiVersion: apps/v1 -kind: Deployment +kind: StatefulSet metadata: name: plausible-events-db labels: @@ -39,6 +28,7 @@ metadata: app.kubernetes.io/part-of: plausible spec: replicas: 1 + serviceName: plausible-events-db selector: matchLabels: app.kubernetes.io/name: clickhouse @@ -52,10 +42,6 @@ spec: app.kubernetes.io/part-of: plausible spec: restartPolicy: Always - volumes: - - name: clickhousedata - persistentVolumeClaim: - claimName: plausible-db-pvc containers: - name: plausible-events-db image: yandex/clickhouse-server:latest @@ -63,7 +49,7 @@ spec: ports: - containerPort: 8123 volumeMounts: - - name: clickhousedata + - name: data mountPath: /var/lib/clickhouse env: - name: CLICKHOUSE_DB @@ -101,3 +87,17 @@ spec: initialDelaySeconds: 30 failureThreshold: 3 periodSeconds: 10 + volumeClaimTemplates: + - metadata: + name: data + labels: + app.kubernetes.io/name: clickhouse + app.kubernetes.io/component: database + app.kubernetes.io/part-of: plausible + spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 128Mi + limits: + storage: 20Gi