144 lines
3.8 KiB
YAML
144 lines
3.8 KiB
YAML
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: postgresql
|
|
namespace: asciinema
|
|
labels:
|
|
app.kubernetes.io/name: postgresql
|
|
app.kubernetes.io/part-of: asciinema
|
|
spec:
|
|
clusterIP: None
|
|
selector:
|
|
app.kubernetes.io/name: postgresql
|
|
app.kubernetes.io/part-of: asciinema
|
|
ports:
|
|
- name: postgresql
|
|
port: 5432
|
|
targetPort: postgresql
|
|
protocol: TCP
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: postgresql
|
|
namespace: asciinema
|
|
labels:
|
|
app.kubernetes.io/name: postgresql
|
|
app.kubernetes.io/part-of: asciinema
|
|
spec:
|
|
serviceName: postgresql
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: postgresql
|
|
app.kubernetes.io/part-of: asciinema
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: postgresql
|
|
app.kubernetes.io/part-of: asciinema
|
|
spec:
|
|
automountServiceAccountToken: false
|
|
terminationGracePeriodSeconds: 120
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 70
|
|
runAsGroup: 70
|
|
fsGroup: 70
|
|
fsGroupChangePolicy: OnRootMismatch
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
containers:
|
|
- name: postgresql
|
|
image: postgres:17.6-alpine
|
|
imagePullPolicy: IfNotPresent
|
|
env:
|
|
- name: POSTGRES_DB
|
|
value: asciinema
|
|
- name: POSTGRES_USER
|
|
value: asciinema
|
|
- name: POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: asciinema-secrets
|
|
key: database-password
|
|
- name: POSTGRES_INITDB_ARGS
|
|
value: --auth-host=scram-sha-256
|
|
- name: PGDATA
|
|
value: /var/lib/postgresql/data/pgdata
|
|
ports:
|
|
- name: postgresql
|
|
containerPort: 5432
|
|
protocol: TCP
|
|
startupProbe:
|
|
exec:
|
|
command:
|
|
- pg_isready
|
|
- --username=asciinema
|
|
- --dbname=asciinema
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
failureThreshold: 60
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- pg_isready
|
|
- --username=asciinema
|
|
- --dbname=asciinema
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
failureThreshold: 3
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- pg_isready
|
|
- --username=asciinema
|
|
- --dbname=asciinema
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
timeoutSeconds: 3
|
|
failureThreshold: 6
|
|
resources:
|
|
requests:
|
|
cpu: 50m
|
|
memory: 128Mi
|
|
ephemeral-storage: 64Mi
|
|
limits:
|
|
cpu: "1"
|
|
memory: 1Gi
|
|
ephemeral-storage: 1Gi
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
readOnlyRootFilesystem: false
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /var/lib/postgresql/data
|
|
- name: run
|
|
mountPath: /var/run/postgresql
|
|
- name: tmp
|
|
mountPath: /tmp
|
|
volumes:
|
|
- name: run
|
|
emptyDir:
|
|
medium: Memory
|
|
sizeLimit: 16Mi
|
|
- name: tmp
|
|
emptyDir:
|
|
sizeLimit: 64Mi
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: data
|
|
labels:
|
|
app.kubernetes.io/name: postgresql
|
|
app.kubernetes.io/part-of: asciinema
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
storageClassName: rook-ceph-block-ec
|
|
resources:
|
|
requests:
|
|
storage: 8Gi
|