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/component: database
app.kubernetes.io/part-of: plausible 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 apiVersion: apps/v1
kind: Deployment kind: StatefulSet
metadata: metadata:
name: plausible-db name: plausible-db
labels: labels:
@ -39,6 +28,7 @@ metadata:
app.kubernetes.io/part-of: plausible app.kubernetes.io/part-of: plausible
spec: spec:
replicas: 1 replicas: 1
serviceName: plausible-db
selector: selector:
matchLabels: matchLabels:
app.kubernetes.io/name: postgres app.kubernetes.io/name: postgres
@ -52,10 +42,6 @@ spec:
app.kubernetes.io/part-of: plausible app.kubernetes.io/part-of: plausible
spec: spec:
restartPolicy: Always restartPolicy: Always
volumes:
- name: pgdata
persistentVolumeClaim:
claimName: plausible-db-pvc
containers: containers:
- name: plausible-db - name: plausible-db
image: postgres:latest image: postgres:latest
@ -63,7 +49,7 @@ spec:
ports: ports:
- containerPort: 5432 - containerPort: 5432
volumeMounts: volumeMounts:
- name: pgdata - name: data
mountPath: /var/lib/postgresql/data mountPath: /var/lib/postgresql/data
env: env:
- name: POSTGRES_DB - name: POSTGRES_DB
@ -107,3 +93,17 @@ spec:
initialDelaySeconds: 30 initialDelaySeconds: 30
failureThreshold: 3 failureThreshold: 3
periodSeconds: 10 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/component: database
app.kubernetes.io/part-of: plausible 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 apiVersion: apps/v1
kind: Deployment kind: StatefulSet
metadata: metadata:
name: plausible-events-db name: plausible-events-db
labels: labels:
@ -39,6 +28,7 @@ metadata:
app.kubernetes.io/part-of: plausible app.kubernetes.io/part-of: plausible
spec: spec:
replicas: 1 replicas: 1
serviceName: plausible-events-db
selector: selector:
matchLabels: matchLabels:
app.kubernetes.io/name: clickhouse app.kubernetes.io/name: clickhouse
@ -52,10 +42,6 @@ spec:
app.kubernetes.io/part-of: plausible app.kubernetes.io/part-of: plausible
spec: spec:
restartPolicy: Always restartPolicy: Always
volumes:
- name: clickhousedata
persistentVolumeClaim:
claimName: plausible-db-pvc
containers: containers:
- name: plausible-events-db - name: plausible-events-db
image: yandex/clickhouse-server:latest image: yandex/clickhouse-server:latest
@ -63,7 +49,7 @@ spec:
ports: ports:
- containerPort: 8123 - containerPort: 8123
volumeMounts: volumeMounts:
- name: clickhousedata - name: data
mountPath: /var/lib/clickhouse mountPath: /var/lib/clickhouse
env: env:
- name: CLICKHOUSE_DB - name: CLICKHOUSE_DB
@ -101,3 +87,17 @@ spec:
initialDelaySeconds: 30 initialDelaySeconds: 30
failureThreshold: 3 failureThreshold: 3
periodSeconds: 10 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