Skip to content

Instantly share code, notes, and snippets.

@jleach

jleach/deploy.yaml

Created Oct 8, 2019
Embed
What would you like to do?
DigitalOcean PostgreSQL Deployment Manifest
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: test
name: postgres-data
labels:
app: postgres
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
storageClassName: do-block-storage
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
namespace: test
labels:
app: postgres
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: xxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/xxxxxxxxx/db:latest
volumeMounts:
- name: data
mountPath: "/var/lib/postgresql"
resources:
limits:
cpu: 50m
memory: 96Mi
requests:
cpu: 40m
memory: 64Mi
ports:
- name: standard-pg
containerPort: 5432
env:
- name: KC_DB_NAME
value: keycloak
- name: KC_DB_USER
valueFrom:
secretKeyRef:
name: keycloak
key: KC_DB_USER
- name: KC_DB_PASSWORD
valueFrom:
secretKeyRef:
name: keycloak
key: KC_DB_PASSWORD
- name: APP_DB_USER
valueFrom:
secretKeyRef:
name: postgres
key: APP_DB_USER
- name: APP_DB_PASSWORD
valueFrom:
secretKeyRef:
name: postgres
key: APP_DB_PASSWORD
- name: APP_DB_NAME
value: probateapp
# readinessProbe:
# exec:
# command:
# [
# 'psql',
# '-U',
# '$APP_DB_USER',
# '-h',
# 'localhost',
# '-d',
# '$APP_DB_NAME',
# '-p',
# '5432',
# '-c',
# 'SELECT 1',
# ]
# initialDelaySeconds: 45
# periodSeconds: 5
# livenessProbe:
# exec:
# command:
# [
# 'psql',
# '-U',
# '$APP_DB_USER',
# '-h',
# 'localhost',
# '-d',
# '$APP_DB_NAME',
# '-p',
# '5432',
# '-c',
# 'SELECT 1',
# ]
# initialDelaySeconds: 45
# periodSeconds: 5
initContainers:
- name: pgsql-data-permission-fix
image: busybox
command: ["/bin/chmod", "-R", "777", "/data"]
volumeMounts:
- name: data
mountPath: /data
volumes:
- name: data
persistentVolumeClaim:
claimName: postgres-data
imagePullSecrets:
- name: us-east-1-ecr-regcred
---
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: test
labels:
app: postgres
spec:
selector:
app: postgres
ports:
- name: standard-pg
port: 5432
targetPort: 5432
protocol: TCP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.