helm custom chart ErrImagePull

1/17/2020

I've been trying to create a custom helm chart however I get ErrImagePull no matter what image I add to my chart, I can re-create this really easily:

helm create my-chart

(using default nginx docker image):

helm install my-chart . 
NAME: my-chart
LAST DEPLOYED: Fri Jan 17 12:26:13 2020
NAMESPACE: example
STATUS: deployed
REVISION: 1
NOTES:

Change values.yaml for a different image (nginx -> ubuntu):

    7 image:
    8   repository: ubuntu
    9   pullPolicy: IfNotPresent

update helm deployment:

helm upgrade my-chart . 
Release "my-chart" has been upgraded. Happy Helming!
NAME: my-chart
LAST DEPLOYED: Fri Jan 17 12:30:13 2020
NAMESPACE: example
STATUS: deployed
REVISION: 2
NOTES:

Pod status:

kubectl get pods
NAME                        READY   STATUS             RESTARTS   AGE
my-chart-54fb9969dd-gnpt9   0/1     ImagePullBackOff   0          32s
my-chart-56485d7b7-hc25q    1/1     Running            0          4m32s

Describe pod:

Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  <unknown>          default-scheduler  Successfully assigned example/my-chart-54fb9969dd-gnpt9 to aw
  Normal   Pulling    15s (x3 over 62s)  kubelet, aw        Pulling image "ubuntu:1.16.0"
  Warning  Failed     13s (x3 over 59s)  kubelet, aw        Failed to pull image "ubuntu:1.16.0": rpc error: code = Unknown desc = failed to resolve image "docker.io/library/ubuntu:1.16.0": no available registry endpoint: docker.io/library/ubuntu:1.16.0 not found
  Warning  Failed     13s (x3 over 59s)  kubelet, aw        Error: ErrImagePull
  Normal   BackOff    1s (x3 over 58s)   kubelet, aw        Back-off pulling image "ubuntu:1.16.0"
  Warning  Failed     1s (x3 over 58s)   kubelet, aw        Error: ImagePullBackOff
-- darthguinea
docker
kubernetes-helm

1 Answer

1/17/2020

The issue is caused by the fact that the helm template defaults with the chart.appversion

image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"

when you helm create my-chart go to the deployments.yaml and change the image: section to either use the tag variable, then from values.yaml add something like this:

 8   repository: ubuntu
 9   tag: latest                 
10   pullPolicy: IfNotPresent    
-- darthguinea
Source: StackOverflow