Kubernetes Script to Deploy a postgres DB with Rollingupdate and persistent storage


apiVersion: apps/v1

kind: Deployment

metadata:

  name: postgres

  namespace: default

  labels:

    app: postgres

  annotations:

    deployment.kubernetes.io/revision: "1"

spec:

  replicas: 1

  strategy:

    type: RollingUpdate

    rollingUpdate:

      maxUnavailable: 1

      maxSurge: 1

  selector:

    matchLabels:

      app: postgres

  template:

    metadata:

      name: postgres

      labels:

        app: postgres

    spec:

      containers:

        - name: postgres

          image: "cpettech.docker.repositories.sap.ondemand.com/jtrack_postgres:howto"

          env:

            - name: POSTGRES_USER

              value: postgres

           - name: POSTGRES_PASSWORD

              value: p5FVqfuJFrM42cVX9muQXxrC3r8S9yn0zqWnFR6xCoPqxqVQ

            - name: POSTGRES_INITDB_XLOGDIR

              value: "/var/log/postgresql/logs"

          ports:

            - containerPort: 5432

          volumeMounts:

            - mountPath: /var/lib/postgresql/data

              name: postgre-db

              subPath: data     # https://github.com/

            - mountPath: /var/log/postgresql/logs

              name: postgre-db

              subPath: logs

      volumes:

        - name: postgre-db

          persistentVolumeClaim:

            claimName: postgresdb-pvc

            readOnly: false

      imagePullSecrets:

      - name: cpettechregistry

Comments

Popular posts from this blog

Push command for NetWorker Client Upgrade

Factors Affecting Users’ Sense of Security and Trust in Integrating Electronic health record to the cloud

Basic Elastic Cloud Storage Troubleshooting Commands