diff --git a/manifests/base/kustomization.yaml b/manifests/base/kustomization.yaml index 0471e1a..a698d3f 100644 --- a/manifests/base/kustomization.yaml +++ b/manifests/base/kustomization.yaml @@ -4,7 +4,9 @@ namespace: locust resources: - namespace.yaml +- postgres-deployment.yaml - secret.yaml +- pvc.yaml - deployment.yaml - service.yaml - ingress.yaml diff --git a/manifests/base/postgres-deployment.yaml b/manifests/base/postgres-deployment.yaml new file mode 100644 index 0000000..24f3d51 --- /dev/null +++ b/manifests/base/postgres-deployment.yaml @@ -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 diff --git a/manifests/built/postgres-deployment.yaml b/manifests/built/postgres-deployment.yaml new file mode 100644 index 0000000..24f3d51 --- /dev/null +++ b/manifests/built/postgres-deployment.yaml @@ -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