--- apiVersion: v1 kind: Secret metadata: name: joplin-postgres namespace: joplin type: Opaque stringData: POSTGRES_DB: joplin POSTGRES_USER: joplin POSTGRES_PASSWORD: "TXIlCX4DUdKZuqbYt2lTaxMXvz6cJi" --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: joplin-postgres-data namespace: joplin spec: accessModes: ["ReadWriteOnce"] storageClassName: longhorn-joplin resources: requests: storage: 10Gi --- apiVersion: apps/v1 kind: Deployment metadata: name: joplin-postgres namespace: joplin spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: joplin-postgres template: metadata: labels: app: joplin-postgres spec: containers: - name: postgres image: postgres:16-alpine ports: - containerPort: 5432 envFrom: - secretRef: name: joplin-postgres env: - name: PGDATA value: /var/lib/postgresql/data/pgdata volumeMounts: - name: data mountPath: /var/lib/postgresql/data startupProbe: exec: command: ["pg_isready", "-U", "joplin", "-d", "joplin"] initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 30 readinessProbe: exec: command: ["pg_isready", "-U", "joplin", "-d", "joplin"] periodSeconds: 10 timeoutSeconds: 5 livenessProbe: exec: command: ["pg_isready", "-U", "joplin", "-d", "joplin"] periodSeconds: 30 timeoutSeconds: 5 failureThreshold: 5 resources: requests: cpu: 100m memory: 256Mi limits: cpu: 1000m memory: 1Gi volumes: - name: data persistentVolumeClaim: claimName: joplin-postgres-data --- apiVersion: v1 kind: Service metadata: name: joplin-postgres namespace: joplin spec: selector: app: joplin-postgres ports: - port: 5432 targetPort: 5432