How to use imagePullSecrets: [] in Helm 3

7/14/2020

Helm 3 imagePullSecrets: [] secrete gives an error.

Error: unable to build Kubernetes objects from release manifest: error validating "": error validating data: ValidationError(Deployment.spec.template.spec.imagePullSecrets0): invalid type for io.k8s.api.core.v1.LocalObjectReference: got "string", expected "map"

-- Rajesh Narayanan
helm-tls
kubernetes
kubernetes-helm

2 Answers

1/11/2022

How to create ImagePullSecret:

https://helm.sh/docs/howto/charts_tips_and_tricks/#creating-image-pull-secrets

Add to deployment:

spec:
    imagePullSecrets:
    - name: myregistrykey
-- Viktors
Source: StackOverflow

7/14/2020

I use this setup and works fine.

In deployment.yaml

    spec:
    {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
    {{- end }}
      containers:

In values.yaml

imagePullSecrets:
  - name: regcred

And create secret regcred manually using

kubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>

You can find detailed documentation here

-- Tek Nath
Source: StackOverflow