apiVersion: apps/v1 kind: Deployment metadata: namespace: projects name: gitea_db spec: replicas: 1 selector: matchLabels: app: gitea_db template: metadata: labels: app: gitea_db spec: containers: - name: postgres image: postgres:15 ports: - containerPort: 5432 env: - name: POSTGRES_USER value: "gitea" - name: POSTGRES_PASSWORD value: "${POSTGRES_PASSWORD}" - name: POSTGRES_DB value: "gitea" volumeMounts: - mountPath: /var/lib/postgresql/data name: postgres-data volumes: - name: postgres-data hostPath: path: /data/gitea/postgres type: DirectoryOrCreate --- apiVersion: v1 kind: Service metadata: name: postgres namespace: projects labels: app: postgres spec: ports: - protocol: TCP port: 5432 targetPort: 5432 selector: app: postgres type: ClusterIP