Percona backup mongodb on kubernetes

9/10/2021

Tries to run percona backup to mongodb on a kubernetes cluster. My setup consists of 6 mongo pods. 1x arbitrator 1x manager 2x config (replicaset) 2x data (replicaset with arbitrator) I added 2 images to each pod, i.e. mongo + perconabackup

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: percona-arbiter
  name: percona-arbiter
spec:
  replicas: 1
  selector:
    matchLabels:
      app: percona-arbiter
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: percona-arbiter
        stack: mongo
    spec:
      containers:
      - image: percona/percona-backup-mongodb
        imagePullPolicy: "Always"
        name: percona-arbiter-backup
        env:
        - name: PBM_MONGODB_URI
          value: "mongodb://pbmuser:secretpwd@percona-arbiter:27017/?authSource=admin&readPreference=primary&ssl=false"
        securityContext:
        volumeMounts:     
        - mountPath: /backup 
          name: percona-nfs-pvc 
        - mountPath: /data/db
          name: percona-mongo-arbiter-pvc      
      - image: mongo:4
        command:
        - /bin/sh
        - -c
        - mongod --keyFile /mongo_keyfile.key --shardsvr --replSet datars --dbpath /data/db --bind_ip 0.0.0.0 --port 27017 --setParameter "transactionLifetimeLimitSeconds=3600"
        imagePullPolicy: "Always"
        name: percona-arbiter
        resources:
          limits:
            memory: "350Mi"
          requests:
            cpu: "10m"
            memory: "256Mi"
        volumeMounts:
        - mountPath: /mongo_keyfile.key
          name: mongo-keyfile
          subPath: mongo_keyfile.key
        - mountPath: /data/db
          name: percona-mongo-arbiter-pvc
        - mountPath: /backup 
          name: percona-nfs-pvc           
        ports:
        - containerPort: 27017
        - containerPort: 27018
      nodeSelector:
        ha-role: perf1
      restartPolicy: Always
      serviceAccountName: ""
      volumes:
      - configMap:
          defaultMode: 256
          items:
          - key: mongo_keyfile.key
            path: mongo_keyfile.key
          name: mongo-keyfile
        name: mongo-keyfile
      - name: percona-mongo-arbiter-pvc
        persistentVolumeClaim:
          claimName: percona-mongo-arbiter-pvc
      - name: percona-nfs-pvc
        persistentVolumeClaim:
          claimName: percona-nfs-pvc           
status: {}

Percona-arbiter-backup shows logs

2021/09/10 08:03:49 connect to PBM: create mongo connection: mongo ping: connection() error occured during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed.

Is it supposed to be done this way? Is there any other way to run percone backup in a k8s cluster

-- noname
backup
kubernetes
mongodb
percona

0 Answers