apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    k8up.io/backupcommand: mongodump --archive -uroot -pexample
  labels:
    app: mongodb
  name: mongodb
  namespace: myproject
spec:
  replicas: 1
  revisionHistoryLimit: 2
  selector:
    matchLabels:
      app: mongodb
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: mongodb
    spec:
      containers:
        - env:
            - name: MONGO_INITDB_ROOT_USERNAME
              value: root
            - name: MONGO_INITDB_ROOT_PASSWORD
              value: example
          image: mongo
          imagePullPolicy: Always
          name: mongodb
          ports:
            - containerPort: 3306
              protocol: TCP
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
            - mountPath: /data/db
              name: mongodb
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
        - name: mongodb
          persistentVolumeClaim:
            claimName: mongodb
