mirror of
https://github.com/plausible/hosting.git
synced 2025-06-16 18:57:29 -05:00
added Kubernetes support
This commit is contained in:
109
kubernetes/plausible-db.yaml
Normal file
109
kubernetes/plausible-db.yaml
Normal file
@ -0,0 +1,109 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: plausible-db
|
||||
labels:
|
||||
app.kubernetes.io/name: postgres
|
||||
app.kubernetes.io/component: database
|
||||
app.kubernetes.io/part-of: plausible
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: db
|
||||
port: 5432
|
||||
targetPort: 5432
|
||||
protocol: TCP
|
||||
selector:
|
||||
app.kubernetes.io/name: postgres
|
||||
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
|
||||
metadata:
|
||||
name: plausible-db
|
||||
labels:
|
||||
app.kubernetes.io/name: postgres
|
||||
app.kubernetes.io/component: database
|
||||
app.kubernetes.io/part-of: plausible
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: postgres
|
||||
app.kubernetes.io/component: database
|
||||
app.kubernetes.io/part-of: plausible
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: postgres
|
||||
app.kubernetes.io/component: database
|
||||
app.kubernetes.io/part-of: plausible
|
||||
spec:
|
||||
restartPolicy: Always
|
||||
volumes:
|
||||
- name: pgdata
|
||||
persistentVolumeClaim:
|
||||
claimName: plausible-db-pvc
|
||||
containers:
|
||||
- name: plausible-db
|
||||
image: postgres:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
volumeMounts:
|
||||
- name: pgdata
|
||||
mountPath: /var/lib/postgresql/data
|
||||
env:
|
||||
- name: POSTGRES_DB
|
||||
value: plausible
|
||||
- name: PGDATA
|
||||
value: /var/lib/postgresql/data/pgdata
|
||||
- name: POSTGRES_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: plausible-db-user
|
||||
key: username
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: plausible-db-user
|
||||
key: password
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
resources:
|
||||
limits:
|
||||
memory: 2Gi
|
||||
cpu: 1500m
|
||||
requests:
|
||||
memory: 128Mi
|
||||
cpu: 250m
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- pg_isready -U postgres
|
||||
initialDelaySeconds: 20
|
||||
failureThreshold: 6
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- pg_isready -U postgres
|
||||
initialDelaySeconds: 30
|
||||
failureThreshold: 3
|
||||
periodSeconds: 10
|
Reference in New Issue
Block a user