0
votes

i have created secret inside Kubernetes cluster for image pull from private repository and added it to helm values.yml.

after deployment start (helm install chart /chart) i see that helm deployment is crashing all the time by timeout.

"kubectl describe pod" shows me an error: "imagePullBackoff" and "wrong credentials".

at the same time if to deploy the same app with kubectl apply -f deployment.yml file this secret works as expected and image is downloaded without any issues and deployment is successful.

the question is how to force this secret to work with helm charts?

2
Could you please show your helm values file and template file? And did you compare your deployment.yaml with helm rendered yaml file to see any differences?Tranvu Xuannhat
sorry, i am still a newbuy with helm. i have only added a secret`s name (created through "kubect create secret") to helm in values.yaml file that it could be able to pull the image. no any template were created for this by me. but as i see helm does not work with this. should i also create a secret in helm format?Костя Хомко
Where is this private repo? How exactly have you added the secret, can you show the whole command without private data? Can you paste the values.yaml?Crou
repo is in azure container registry. values.yml looks like that jumpshare.com/v/tbOMLOxQCEJA1z1FuIOQКостя Хомко

2 Answers

0
votes

Try creating secret using this command:

kubectl  create secret docker-registry mysecret --docker-server=<docker-repo> --docker-username=<docker-username> --docker-password=<docker-password> --docker-email=<email>

(Provide your respective inputs in the above command)

-1
votes

From helm document

First, assume that the credentials are defined in the values.yaml file like so:

imageCredentials:
  registry: quay.io
  username: someone
  password: sillyness

We then define our helper template as follows:

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

Finally, we use the helper template in a larger template to create the Secret manifest:

apiVersion: v1
kind: Secret
metadata:
  name: myregistrykey
type: kubernetes.io/dockerconfigjson
data:
  .dockerconfigjson: {{ template "imagePullSecret" . }}

In deployment

  containers:
  - name: private-reg-container
    image: <your-private-image>
  imagePullSecrets:
  - name: myregistrykey