Skip to content

[Bug]: unable to backup when we are more than 1 container in pod #8966

@Joda89

Description

@Joda89

Is there an existing issue already for this bug?

  • I have searched for an existing issue, and could not find anything. I believe this is a new bug.

I have read the troubleshooting guide

  • I have read the troubleshooting guide and I think this is a new bug.

I am running a supported version of CloudNativePG

  • I have read the troubleshooting guide and I think this is a new bug.

Contact Details

Version

1.27 (latest patch)

What version of Kubernetes are you using?

1.34

What is your Kubernetes environment?

Self-managed: kind (evaluation)

How did you install the operator?

YAML manifest

What happened?

When deploying a PostgreSQL cluster via CNPG and Istio is enabled on the namespace, Istio automatically adds a sidecar to the pod or controller when it performs the backup, comparing the image of the first container with the image defined in the CNPG cluster. The problem is that if the first container is not PostgreSQL, the backup remains stuck in ‘Active’ status and this error message appears in the controller logs:

{‘level’:‘debug’,“ts”:" 2025-10-26T07:49:29.003680028Z‘,’msg‘:’Instance not having expected image, discarded as target for backup‘,’controller‘:’backup‘,’controllerGroup‘:’postgresql.cnpg.io‘,’controllerKind‘:“Backup”,’ Backup‘:{’name‘:’postgresql-20251026084856‘,’namespace‘:’databases‘},’namespace‘:’databases‘,“name”:’postgresql-20251026084856‘,’ reconcileID‘:’f4dd8a41-2755-4086-89f8-e1daa10bb2bc‘,“caller”:’internal/controller/backup_controller.go:692"}

Cluster resource

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: postgresql
  namespace: databases
spec:
  monitoring:
    enablePodMonitor: true
  instances: 3
  imageCatalogRef:
    apiGroup: postgresql.cnpg.io
    kind: ClusterImageCatalog
    name: postgresql-minimal-trixie
    major: 18
  resources:
    limits:
      memory: 600Mi
    requests:
      cpu: 200m
      memory: 600Mi
  plugins:
    - name: barman-cloud.cloudnative-pg.io
      isWALArchiver: true
      parameters:
        barmanObjectName: minio-store
  storage:
    storageClass: longhorn
    size: 4Gi
  walStorage:
    storageClass: longhorn
    size: 4Gi
  backup:
    volumeSnapshot:
       className: longhorn
  bootstrap:
    initdb:
      database: bitnami_keycloak
      owner: bn_keycloak
      secret:
        name: postgresql-app
 managed:
    roles:
    - name: admin
      ensure: present
      comment: admin user
      login: true
      superuser: true
      passwordSecret:
        name: postgresql-admin
    - name: adhesion
      ensure: present
      comment: adhesion user
      login: true
      superuser: false
      passwordSecret:
        name: postgresql-adhesion
    - name: bn_keycloak
      ensure: present
      comment: bn_keycloak user
      login: true
      superuser: false
      passwordSecret:
        name: postgresql-app
    - name: communication
      ensure: present
      comment: communication user
      login: true
      superuser: false
      passwordSecret:
        name: postgresql-communication
    - name: finance
      ensure: present
      comment: finance user
      login: true
      superuser: false
      passwordSecret:
        name: postgresql-finance
    - name: sonar
      ensure: present
      comment: sonar user
      login: true
      superuser: false
      passwordSecret:
        name: postgresql-sonar

Relevant log output

{"level":"debug","ts":"2025-10-26T07:49:28.615298496Z","msg":"reconciling object `databases/postgresql-20251026084856`","controller":"backup","controllerGroup":"postgresql.cnpg.io","controllerKind":"Backup","Backup":{"name":"postgresql-20251026084856","namespace":"databases"},"namespace":"databases","name":"postgresql-20251026084856","reconcileID":"f4dd8a41-2755-4086-89f8-e1daa10bb2bc","caller":"internal/controller/backup_controller.go:116"}
{"level":"debug","ts":"2025-10-26T07:49:28.637618Z","msg":"Found cluster for backup","controller":"backup","controllerGroup":"postgresql.cnpg.io","controllerKind":"Backup","Backup":{"name":"postgresql-20251026084856","namespace":"databases"},"namespace":"databases","name":"postgresql-20251026084856","reconcileID":"f4dd8a41-2755-4086-89f8-e1daa10bb2bc","caller":"internal/controller/backup_controller.go:164","cluster":"postgresql"}
{"level":"debug","ts":"2025-10-26T07:49:29.003337907Z","msg":"Instance not having expected image, discarded as target for backup","controller":"backup","controllerGroup":"postgresql.cnpg.io","controllerKind":"Backup","Backup":{"name":"postgresql-20251026084856","namespace":"databases"},"namespace":"databases","name":"postgresql-20251026084856","reconcileID":"f4dd8a41-2755-4086-89f8-e1daa10bb2bc","caller":"internal/controller/backup_controller.go:692"}
{"level":"debug","ts":"2025-10-26T07:49:29.003383699Z","msg":"Instance not having expected image, discarded as target for backup","controller":"backup","controllerGroup":"postgresql.cnpg.io","controllerKind":"Backup","Backup":{"name":"postgresql-20251026084856","namespace":"databases"},"namespace":"databases","name":"postgresql-20251026084856","reconcileID":"f4dd8a41-2755-4086-89f8-e1daa10bb2bc","caller":"internal/controller/backup_controller.go:692"}
{"level":"debug","ts":"2025-10-26T07:49:29.003396823Z","msg":"Instance not having expected image, discarded as target for backup","controller":"backup","controllerGroup":"postgresql.cnpg.io","controllerKind":"Backup","Backup":{"name":"postgresql-20251026084856","namespace":"databases"},"namespace":"databases","name":"postgresql-20251026084856","reconcileID":"f4dd8a41-2755-4086-89f8-e1daa10bb2bc","caller":"internal/controller/backup_controller.go:692"}
{"level":"debug","ts":"2025-10-26T07:49:29.003407323Z","msg":"No ready instances found as target for backup, defaulting to primary","controller":"backup","controllerGroup":"postgresql.cnpg.io","controllerKind":"Backup","Backup":{"name":"postgresql-20251026084856","namespace":"databases"},"namespace":"databases","name":"postgresql-20251026084856","reconcileID":"f4dd8a41-2755-4086-89f8-e1daa10bb2bc","caller":"internal/controller/backup_controller.go:738"}
{"level":"debug","ts":"2025-10-26T07:49:29.003680028Z","msg":"Instance not having expected image, discarded as target for backup","controller":"backup","controllerGroup":"postgresql.cnpg.io","controllerKind":"Backup","Backup":{"name":"postgresql-20251026084856","namespace":"databases"},"namespace":"databases","name":"postgresql-20251026084856","reconcileID":"f4dd8a41-2755-4086-89f8-e1daa10bb2bc","caller":"internal/controller/backup_controller.go:692"}
{"level":"info","ts":"2025-10-26T07:49:29.003763735Z","msg":"Couldn't find target pod, will retry in 30 seconds","controller":"backup","controllerGroup":"postgresql.cnpg.io","controllerKind":"Backup","Backup":{"name":"postgresql-20251026084856","namespace":"databases"},"namespace":"databases","name":"postgresql-20251026084856","reconcileID":"f4dd8a41-2755-4086-89f8-e1daa10bb2bc","target":"postgresql-2"}
{"level":"info","ts":"2025-10-26T07:49:29.003988607Z","logger":"events","msg":"Couldn't find target pod postgresql-2, will retry in 30 seconds","type":"Warning","object":{"kind":"Backup","namespace":"databases","name":"postgresql-20251026084856","uid":"a22c1a8e-aaa9-46ec-9a96-aadefdafa1c1","apiVersion":"postgresql.cnpg.io/v1","resourceVersion":"1077019247"},"reason":"FindingPod"}

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Labels

bug 🐛Something isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions