Skip to content

imagePullSecretes

imagePullSecrets value in Kubedeploy should contain a list of Secret objects that contains necessary configuration for pulling container images from private registries.

See the official documentation on this feature.

By default no imagePullSecretes are defined in Kubedeploy.

Define extraSecrets and imagePullSecrets

We will use Kubedeploys extraSecrets value for defining Secret object later used in imagePullSecretes.

values.yaml
nameOverride: my-app # (1)
image:
  repository: private-repo/image-name
  tag: latest
  pullPolicy: Always

imagePullSecrets:
  - webapp-my-app-imagepullsecret # (2)

extraSecrets:
  - name: imagepullsecret # (3)
    type: kubernetes.io/dockerconfigjson
    data:
      .dockerconfigjson: |
        content of ~/.docker/config.json file # (4)
  1. define nameOverride for easier secret reference
  2. secret name deployed with extraSecrets is prefixed with kubedeploy.fullname templated.
  3. create extra secret named imagepullsecret
  4. content should be replaced with content from ~/.docker/config.json file
Deploy command
helm install webapp sysbee/kubedeploy -f values.yaml

Note

Secret objects deployed with extraSecrets are prefixed with deployment full name.

Tip

When deploying multiple applications from same private image registry, it is recommended to create Secret object by hand and then reference it in Kubedeploy.

Example

Create a secret

Create my-registry-creds secret
1
2
3
4
5
kubectl create secret docker-registry my-registry-creds \
--docker-email=tiger@acme.example \
--docker-username=tiger \
--docker-password=pass1234 \
--docker-server=my-registry.example:5000

Reference the manually created secret

values.yaml
1
2
3
4
5
6
7
image:
  repository: my-registry.example/image-name
  tag: latest
  pullPolicy: Always

imagePullSecrets:
  - my-registry-creds
Deploy command
helm install webapp sysbee/kubedeploy -f values.yaml

See also: