<p>I created a cronjob with the following spec in GKE:</p>
<pre><code># cronjob.yaml
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: collect-data-cj-111
spec:
  schedule: &quot;*/5 * * * *&quot;
  concurrencyPolicy: Allow
  startingDeadlineSeconds: 100
  suspend: false
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 1
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: collect-data-cj-111
            image: collect_data:1.3
          restartPolicy: OnFailure
</code></pre>
<p>I create the cronjob with the following command:</p>
<pre><code>kubectl apply -f collect_data.yaml
</code></pre>
<p>When I later watch if it is running or not (as I scheduled it to run every 5th minute for for the sake of testing), here is what I see:</p>
<pre><code>$ kubectl get pods --watch
NAME                                 READY   STATUS              RESTARTS   AGE
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   0/1     Pending             0          0s
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   0/1     Pending             0          1s
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   0/1     ContainerCreating   0          1s
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   0/1     ErrImagePull        0          3s
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   0/1     ImagePullBackOff    0          17s
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   0/1     ErrImagePull        0          30s
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   0/1     ImagePullBackOff    0          44s
</code></pre>
<p>It does not seem to be able to pull the image from Artifact Registry. I have both GKE and Artifact Registry created under the same project.</p>
<p>What can be the reason? After spending several hours in docs, I still could not make progress and I am quite new in the world of GKE.</p>
<p>If you happen to recommend me to check anything, I really appreciate if you also describe where in GCP I should check/control your recommendation.</p>
<hr />
<p>ADDENDUM:</p>
<p>When I run the following command:</p>
<pre><code>kubectl describe pods
</code></pre>
<p>The output is quite large but I guess the following message should indicate the problem.</p>
<pre><code>    Failed to pull image &quot;collect_data:1.3&quot;: rpc error: code = Unknown 
desc = failed to pull and unpack image &quot;docker.io/library/collect_data:1.3&quot;:
 failed to resolve reference &quot;docker.io/library/collect_data:1.3&quot;: pull 
access denied, repository does not exist or may require authorization: 
server message: insufficient_scope: authorization failed
</code></pre>
<p>How do I solve this problem step by step?</p>

edn
<p>From the error shared, I can tell that the image is not being pulled from Artifact Registry, and the reason for failure is because, by default, GKE pulls it directly from Docker Hub unless specified otherwise. Since there is no collect_data image there, hence the error.</p>
<p>The correct way to specify an image stored in Artifact Registry is as follows:</p>
<pre><code>image: &lt;location&gt;-docker.pkg.dev/&lt;project&gt;/&lt;repo-name&gt;/&lt;image-name:tag&gt;
</code></pre>
<p>Be aware that the registry format has to be set to &quot;docker&quot; if you are using a docker-containerized image.</p>
<p>Take a look at the <a href="https://cloud.google.com/artifact-registry/docs/docker/quickstart#gcloud" rel="nofollow noreferrer">Quickstart for Docker</a> guide, where it is specified how to pull and push docker images to Artifact Registry along with the permissions required.</p>
