plausible/kubernetes/plausible-db.yaml

115 lines
3.1 KiB
YAML
Raw Permalink Normal View History

2021-07-15 04:36:49 -05:00
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: apps/v1
2021-07-19 00:54:58 -05:00
kind: StatefulSet
2021-07-15 04:36:49 -05:00
metadata:
name: plausible-db
labels:
app.kubernetes.io/name: postgres
app.kubernetes.io/component: database
app.kubernetes.io/part-of: plausible
spec:
replicas: 1
2021-07-19 00:54:58 -05:00
serviceName: plausible-db
2021-07-15 04:36:49 -05:00
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
# see https://github.com/docker-library/postgres/blob/6bbf1c7b308d1c4288251d73c37f6caf75f8a3d4/14/buster/Dockerfile
securityContext:
runAsUser: 999
runAsGroup: 999
fsGroup: 999
2021-07-15 04:36:49 -05:00
containers:
- name: plausible-db
image: postgres:latest
imagePullPolicy: Always
ports:
- containerPort: 5432
volumeMounts:
2021-07-19 00:54:58 -05:00
- name: data
2021-07-15 04:36:49 -05:00
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: 65Mi
cpu: 15m
2021-07-15 04:36:49 -05:00
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
2021-07-19 00:54:58 -05:00
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