84 lines
1.7 KiB
YAML
84 lines
1.7 KiB
YAML
|
apiVersion: apps/v1
|
||
|
kind: StatefulSet
|
||
|
metadata:
|
||
|
namespace: default
|
||
|
name: postgres-app
|
||
|
spec:
|
||
|
replicas: 1
|
||
|
selector:
|
||
|
matchLabels:
|
||
|
app: postgres-app
|
||
|
template:
|
||
|
metadata:
|
||
|
labels:
|
||
|
app: postgres-app
|
||
|
spec:
|
||
|
containers:
|
||
|
- name: system
|
||
|
image: repository.umisen.com/external/postgres:alpha
|
||
|
imagePullPolicy: IfNotPresent
|
||
|
command: ["/app/echo_app"]
|
||
|
- env:
|
||
|
- name: PGDATA
|
||
|
value: '/var/lib/postgresql/data/pgdata'
|
||
|
- name: POSTGRES_PASSWORD
|
||
|
value: 'Foobar123'
|
||
|
ports:
|
||
|
- containerPort: 5432
|
||
|
resources:
|
||
|
limits:
|
||
|
memory: 256Mi
|
||
|
cpu: 1
|
||
|
volumeMounts:
|
||
|
- mountPath: /var/lib/postgresql/data
|
||
|
name: postgres-data
|
||
|
volumes:
|
||
|
- name: postgres-data
|
||
|
persistentVolumeClaim:
|
||
|
claimName: postgres-pvc
|
||
|
|
||
|
---
|
||
|
apiVersion: v1
|
||
|
kind: PersistentVolumeClaim
|
||
|
metadata:
|
||
|
namespace: default
|
||
|
name: postgres-pvc
|
||
|
spec:
|
||
|
accessModes: ["ReadWriteOnce"]
|
||
|
storageClassName: "postgres-storage"
|
||
|
resources:
|
||
|
requests:
|
||
|
storage: 1Gi
|
||
|
|
||
|
---
|
||
|
apiVersion: v1
|
||
|
kind: PersistentVolume
|
||
|
metadata:
|
||
|
namespace: default
|
||
|
name: postgres-pv
|
||
|
spec:
|
||
|
capacity:
|
||
|
storage: 1Gi
|
||
|
accessModes:
|
||
|
- ReadWriteOnce
|
||
|
persistentVolumeReclaimPolicy: Retain
|
||
|
hostPath:
|
||
|
path: /data/postgres-app
|
||
|
type: ""
|
||
|
storageClassName: "postgres-storage"
|
||
|
volumeMode: Filesystem
|
||
|
---
|
||
|
apiVersion: v1
|
||
|
kind: Service
|
||
|
metadata:
|
||
|
namespace: default
|
||
|
name: postgres-svc
|
||
|
spec:
|
||
|
selector:
|
||
|
app: postgres-app
|
||
|
type: ClusterIP
|
||
|
ports:
|
||
|
- name: postgres-tcp
|
||
|
protocol: TCP
|
||
|
port: 5432
|
||
|
targetPort: 5432
|