Kubernetes imagePullSecrets not working; getting pull access denied

588 Views Asked by At

I am using kubectl 1.18.1 for both client and server versions. I have specified imagePullSecrets in my StatefulSet manifest and created a docker-registry secret which contains the following content:

{
    "auths": {
       "registryserver.com": {
           "username": "foo",
           "password": "password",
           "auth": "base64string"
       }
    }
}

However, the pod still fails to pull the image from the registry. Any advice and insight is appreciated.

1

There are 1 best solutions below

0
On

You can use the below with Helm templates:

filename : _imagepullsecret_helper.tpl

/* image pull secret */
{{- define "imagePullSecret" }}
{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.imageCredentials.registry (printf "%s:%s" .Values.imageCredentials.username .Values.imageCredentials.password | b64enc) | b64enc }}
{{- end }}