changed databases to StatefulSet

This commit is contained in:
Oscar Beaumont 2021-07-19 13:54:58 +08:00
parent ee329a3138
commit 03919f11f1
2 changed files with 34 additions and 34 deletions

View File

@ -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

View File

@ -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