invalid spec initContainers startupProbe Forbidden with barman cloud plugin
Cluster pod does not start if I add barman cloud plugin with objectstore for WAL and backup purposes, I see invalid spec initContainers startupProbe Forbidden logs in operator logs attached below
cloudnative pg operator Version 1.26 (latest patch)
What version of Kubernetes are you using? 1.30
What is your Kubernetes environment? Cloud: Azure AKS
How did you install the operator? Helm
objectstore yaml
apiVersion: v1
kind: Secret
metadata:
name: testcnpg-azobjectstore-secret
type: Opaque
stringData:
AZURE_CONNECTION_STRING: "DefaultEndpointsProtocol=https;AccountName=xxx;AccountKey=xxxx;EndpointSuffix=core.windows.net"
---
apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
name: testcnpg-azobjectstore
spec:
configuration:
destinationPath: "https://xxx.blob.core.windows.net/cnpg-backups/testcnpg"
azureCredentials:
connectionString:
name: testcnpg-azobjectstore-secret
key: AZURE_CONNECTION_STRING
wal:
compression: gzip
retentionPolicy: 30d
Cluster resource
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: testcnpg
spec:
instances: 1
imageName: ghcr.io/cloudnative-pg/postgresql:15.10
postgresql:
parameters:
shared_buffers: 256MB
log_statement: mod
log_connections: "off"
log_disconnections: "off"
bootstrap:
initdb:
database: testcnpg
plugins:
- name: barman-cloud.cloudnative-pg.io
isWALArchiver: true
parameters:
barmanObjectName: testcnpg-azobjectstore
storage:
storageClass: managed-csi
size: 1Gi
operator logs
{"level":"info","ts":"2025-07-14T14:01:55.17739142Z","msg":"Creating new Pod to reattach a PVC","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"testcnpg","namespace":"infra"},"namespace":"infra","name":"testcnpg","reconcileID":"b55c5ff4-acc2-48c4-96c3-419ce6c1ed9d","pod":"testcnpg-1","pvc":"testcnpg-1"}
{"level":"error","ts":"2025-07-14T14:01:55.727993328Z","msg":"Reconciler error","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"testcnpg","namespace":"infra"},"namespace":"infra","name":"testcnpg","reconcileID":"b55c5ff4-acc2-48c4-96c3-419ce6c1ed9d","error":"unable to create Pod: Pod \"testcnpg-1\" is invalid: spec.initContainers[1].startupProbe: Forbidden: may not be set for init containers without restartPolicy=Always","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).reconcileHandler\n\tpkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:347\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).processNextWorkItem\n\tpkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:294\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func2.2\n\tpkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:255"}
Update: I found that this issue only happens when cluster(defined with barman plugin) is deployed in a different namespace than where operator and barman cloud deployment is running, if we deploy it in the same namespace as operator and barman deployment, it runs fine, please take a look.
更新:我发现这个问题只在集群(用barman插件定义)部署在与operator和barman云部署不同的命名空间时出现,如果我们在与operator和barman部署相同的命名空间部署中部署,运行正常,请检查一下。
Update: I found that this issue only happens when cluster(defined with barman plugin) is deployed in a different namespace than where operator and barman cloud deployment is running, if we deploy it in the same namespace as operator and barman deployment, it runs fine, please take a look.
same namespace don't work.