ERROR: Job failed: image pull failed: Back-off pulling image using GitLab on Kubernetes

I’m using GitLab deployed on Kubernetes using the official Helm chart, version 11.9.0

I have two private projects A and B. A builds and pushes a docker image to the internal container registry. Project B then uses that image as its CI container. However, this results in ERROR: Job failed: image pull failed: Back-off pulling image.

I read in the docs that GitLab runner can automatically authenticate with the internal registry, so this should work. This is the gitlab-ci.yml I’m using for project B:


foo:
  image: $CI_REGISTRY/project-a:bar
  script: ...

This is the log output from the task:

Running with gitlab-runner 11.8.0 (4745a6f3)
  on gitlab-gitlab-runner-7b9576474b-t45pk yf_hmeGJ
Using Kubernetes namespace: default
Using Kubernetes executor with image <registry>/project-a:bar ...
Waiting for pod default/runner-yfhmegj-project-1-concurrent-0msc8v to be running, status is Pending
Waiting for pod default/runner-yfhmegj-project-1-concurrent-0msc8v to be running, status is Pending
Waiting for pod default/runner-yfhmegj-project-1-concurrent-0msc8v to be running, status is Pending
Waiting for pod default/runner-yfhmegj-project-1-concurrent-0msc8v to be running, status is Pending
Waiting for pod default/runner-yfhmegj-project-1-concurrent-0msc8v to be running, status is Pending
Waiting for pod default/runner-yfhmegj-project-1-concurrent-0msc8v to be running, status is Pending
ERROR: Job failed: image pull failed: Back-off pulling image "<registry>/project-a:bar"

Is this use case not supported or am I missing some configuration?

I just started having the same issue. It was working, and now after upgrading the gitlab chart to 12.0.3 I started having this problem. Not sure if it happening after the upgrade is coincidence or not.

Have not been able to figure out a solution or cause yet.

I was able to resolve the problem by adding the following section to the helm chart values.yaml.

nginx-ingress:
  enabled: true
  controller:
    service:
      externalTrafficPolicy: "Cluster"

A little frustrating that it broke without me doing anything.

Which values.yaml ? From the Gitlab Runner Chart?

Your helm release values.yaml, in other words the values you get from helm get values gitlab