Image Credentials Helper

Create Docker registry secrets (kubernetes.io/dockerconfigjson) with the ohMyHelm imageCredentials helper and wire them up via imagePullSecrets.

Image Credentials Helper

The imageCredentials helper creates Kubernetes Secrets of type kubernetes.io/dockerconfigjson so Pods can pull container images from private registries (such as Harbor, GitLab Container Registry, Docker Hub, or GHCR).

Supported Fields

According to values.schema.json, each entry in imageCredentials[] accepts exactly these five fields (additionalProperties: false):

Field Required Description
name Yes Name of the generated v1/Secret
namespace Recommended (always specify!) Target namespace for the Secret
registry Yes Registry URL (for example, https://registry.acme.corp or https://index.docker.io/v1/)
username Yes Username or robot/deploy token name
accessToken Yes Access token or password

Basic Configuration

imageCredentials:
  - name: acme-harbor-pull
    namespace: acme-prod
    registry: https://registry.acme.corp
    username: robot$acme-pull
    accessToken: "<token-passed-via-ci>"

Multiple Registries and Namespaces

Because Kubernetes requires image pull secrets per namespace, define multiple entries as needed:

imageCredentials:
  - name: gitlab-registry-pull
    namespace: acme-staging
    registry: https://registry.gitlab.com
    username: gitlab+deploy-token-123
    accessToken: "<staging-token>"

  - name: gitlab-registry-pull
    namespace: acme-prod
    registry: https://registry.gitlab.com
    username: gitlab+deploy-token-456
    accessToken: "<prod-token>"

Usage in a Chart Workload (chart.imagePullSecrets)

Reference the generated Secret directly under chart.imagePullSecrets in Chart mode (and not under chart.rbac — there is no "RBAC helper" for image pull secrets):

imageCredentials:
  - name: acme-harbor-pull
    namespace: acme-prod
    registry: https://registry.acme.corp
    username: robot$acme-pull
    accessToken: "<token>"

chart:
  enabled: true
  fullnameOverride: "acme-backend"
  imagePullSecrets:
    - name: acme-harbor-pull
  container:
    image: registry.acme.corp/acme/backend:2.1.0
    ports:
      - name: http
        containerPort: 8080

Passing Credentials Securely

Never store accessToken in plaintext in Git. Because ohMyHelm does not perform tpl templating in values.yaml, pass tokens from your CI/CD pipeline via --set or use a secrets operator (such as External Secrets Operator) in GitOps setups:

helm upgrade --install acme-backend . \
  --namespace acme-prod \
  -f values.yaml \
  --set imageCredentials[0].accessToken="$REGISTRY_PULL_TOKEN"

Related Pages