Skip to content

Commit

Permalink
[deployment] add Digitalocean k8s Deploy Config for postgresql
Browse files Browse the repository at this point in the history
  • Loading branch information
welbon committed Jul 5, 2024
1 parent a96df94 commit 57aa506
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ spec:
- name: es-data
persistentVolumeClaim:
claimName: es-pvc
- name: elasticsearch-config
- name: elasticsearch-,.ujv config
configMap:
name: elasticsearch-config
---
Expand Down Expand Up @@ -97,7 +97,6 @@ spec:
resources:
requests:
storage: 80Gi

---
# Elasticsearch Service
apiVersion: v1
Expand Down
File renamed without changes.
90 changes: 90 additions & 0 deletions kube/base-components/postgresql-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Persistent Volume
apiVersion: v1
kind: PersistentVolume
metadata:
name: postgres-pv
spec:
capacity:
storage: 80Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: do-block-storage
hostPath:
path: /mnt/data/postgres
---
# Persistent Volume Claim
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 80Gi
volumeName: postgres-pv
storageClassName: do-block-storage
---
# Postgresql deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:13
ports:
- containerPort: 5432
env:
- name: POSTGRES_DB
value: starcoin
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgresql
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgresql
key: password
resources:
requests:
memory: "4Gi"
cpu: "2"
limits:
memory: "4Gi"
cpu: "2"
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgres-storage
volumes:
- name: postgres-storage
persistentVolumeClaim:
claimName: postgres-pvc
---
# Service
apiVersion: v1
kind: Service
metadata:
name: postgres-service
spec:
type: ClusterIP
ports:
- port: 5432
targetPort: 5432
selector:
app: postgres

0 comments on commit 57aa506

Please sign in to comment.