Skip to content

Commit

Permalink
Added a second pod for postgresql db.
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredeen committed May 2, 2024
1 parent 72e208d commit e6008fd
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
2 changes: 2 additions & 0 deletions manifests/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ namespace: locust

resources:
- namespace.yaml
- postgres-deployment.yaml
- secret.yaml
- pvc.yaml
- deployment.yaml
- service.yaml
- ingress.yaml
Expand Down
58 changes: 58 additions & 0 deletions manifests/base/postgres-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: v1
kind: Secret
metadata:
name: postgres-secret
type: Opaque
data:
POSTGRES_USER: bG9jdXN0
POSTGRES_PASSWORD: Q2JpNk42RWVSUGc2RTdC
---
apiVersion: v1
kind: Service
metadata:
name: postgres-service
spec:
selector:
app: postgres
ports:
- name: postgres
port: 5432
targetPort: 5432
clusterIP: None # Use headless service for better scalability and discovery
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres-deployment
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:latest
envFrom:
- secretRef:
name: postgres-secret
ports:
- containerPort: 5432
resources:
limits:
cpu: "1"
memory: "1Gi"
requests:
cpu: "250m"
memory: "64Mi"
volumeMounts:
- name: postgres-storage
mountPath: /var/lib/postgresql/data
volumes:
- name: postgres-storage
persistentVolumeClaim:
claimName: data-pvc
58 changes: 58 additions & 0 deletions manifests/built/postgres-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: v1
kind: Secret
metadata:
name: postgres-secret
type: Opaque
data:
POSTGRES_USER: bG9jdXN0
POSTGRES_PASSWORD: Q2JpNk42RWVSUGc2RTdC
---
apiVersion: v1
kind: Service
metadata:
name: postgres-service
spec:
selector:
app: postgres
ports:
- name: postgres
port: 5432
targetPort: 5432
clusterIP: None # Use headless service for better scalability and discovery
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres-deployment
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:latest
envFrom:
- secretRef:
name: postgres-secret
ports:
- containerPort: 5432
resources:
limits:
cpu: "1"
memory: "1Gi"
requests:
cpu: "250m"
memory: "64Mi"
volumeMounts:
- name: postgres-storage
mountPath: /var/lib/postgresql/data
volumes:
- name: postgres-storage
persistentVolumeClaim:
claimName: data-pvc

0 comments on commit e6008fd

Please sign in to comment.