Manifest example for creating deployment and service for PostgreSQL
manifest.yml
apiVersion: apps/v1 kind: Deployment metadata: name: postgres namespace: staging labels: app: postgres-app spec: replicas: 1 selector: matchLabels: app: postgres-app strategy: type: RollingUpdate progressDeadlineSeconds: 300 template: metadata: labels: app: postgres-app spec: containers: - image: postgres:11 name: postgres imagePullPolicy: "IfNotPresent" ports: - containerPort: 5432 volumeMounts: - mountPath: /var/lib/postgresql/data subPath: data/postgres/data name: persistent-storage volumes: - name: persistent-storage persistentVolumeClaim: claimName: persistent-storage --- apiVersion: v1 kind: Service metadata: name: postgres-svc namespace: staging spec: ports: - port: 5432 targetPort: 5432 selector: app: postgres-app