added conf files for k8s

This commit is contained in:
2025-12-18 15:34:28 +03:00
commit 514b401aae
28 changed files with 1406 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: replica
namespace: cluster1
spec:
serviceName: replica
replicas: 1
selector:
matchLabels:
app: replica
template:
metadata:
labels:
app: replica
spec:
containers:
- name: postgres
image: postgres:15-alpine
ports:
- containerPort: 5432
env:
- name: POSTGRES_DB
value: replica_db
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: cluster1-postgres-secret
key: POSTGRES_USER
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: cluster1-postgres-secret
key: POSTGRES_PASSWORD
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
command:
- /bin/sh
- -c
- |
chmod +x /replication-scripts/entrypoint-replica.sh
exec /replication-scripts/entrypoint-replica.sh
volumeMounts:
- name: replica-data
mountPath: /var/lib/postgresql/data
- name: replication-scripts
mountPath: /replication-scripts
volumes:
- name: replica-data
persistentVolumeClaim:
claimName: replica-data
- name: replication-scripts
configMap:
name: cluster1-replication-scripts
defaultMode: 0755
---
apiVersion: v1
kind: Service
metadata:
name: replica
namespace: cluster1
spec:
type: ClusterIP
selector:
app: replica
ports:
- name: postgres
port: 5432
targetPort: 5432