Skip to content

[Bug]: kubectl-cnpg: pgbench job fails to pull images from private registries (missing ImagePullSecrets) #10037

Closed

Description

@rafaelthca

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

[email protected]

Version

1.28 (latest patch)

What version of Kubernetes are you using?

1.35

What is your Kubernetes environment?

Cloud: Amazon EKS

How did you install the operator?

YAML manifest

What happened?

Description:

When using the kubectl cnpg pgbench command against a cluster that uses a private registry, the generated Job fails with ImagePullBackOff. While the Job correctly identifies the image to use from cluster.Status.Image, it does not copy the ImagePullSecrets defined in the Cluster spec to the Job's Pod template.

Environment:

  • Operator Version: 1.28
  • Kubernetes Version: 1.35
  • CloudNativePG Plugin Version: 1.28.1 Commit:1ecc48340 Date:2026-02-05

Steps to Reproduce:

  1. Create a CNPG Cluster using an image from a private registry requiring imagePullSecrets.
  2. Run the pgbench plugin command: kubectl cnpg pgbench --job-name bench-test.
  3. Inspect the created job: kubectl get job bench-test -o yaml.
  4. Observe that spec.template.spec.imagePullSecrets is missing.

Probable Root Cause:

In internal/cmd/plugin/pgbench/pgbench.go, the buildJob function populates the PodSpec but omits the ImagePullSecrets field from the cluster specification.

Proposed Fix:

The imagePullSecrets from the Cluster object should be passed into the PodSpec of the Job

Cluster resource

Relevant log output

Code of Conduct

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

Activity

  1. self-assigned this
    on Feb 20, 2026
  2. added a commit that references this issue on Mar 10, 2026
    da1cbdb
  3. added 3 commits that reference this issue on Mar 10, 2026
    79c4eab
    4f68dc0
    7e6c185
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

triagePending triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions