<p>I want to update my deployment on kubernetes with a new image which exists on 'eu.gcr.io' (same project), I have done this before. But now the pods fail to pull the image because they are not authorized to do so. This is the error that we get in the pod logs.</p>

<pre><code>Failed to pull image "eu.gcr.io/my-gcp-project/my-image:v1.009": 
rpc error: code = Unknown desc = Error response from daemon: 
unauthorized: You don't have the needed permissions to perform this operation,
and you may have invalid credentials.
</code></pre>

<p>The service account on the cluster has <strong>kubernetes admin</strong> and <strong>storage admin</strong> roles which should be <a href="https://cloud.google.com/container-registry/docs/access-control#granting_users_and_other_projects_access_to_a_registry" rel="noreferrer">sufficient</a>. But even when I make the service account <strong>project editor</strong> (for debugging sake) it still doesn't work (same error).</p>

<p>I have also tried creating a fresh new cluster (default settings) and apply my deployment there, but then I got the exact same issue.</p>

<p>I'm not sure what I can try anymore.</p>

<p>Any help or suggestions are greatly appreciated.</p>

<p>EDIT:</p>

<p>I just found out that I can still pull and deploy older images. But every new image I build cannot be pulled by the kubernetes pods.</p>

<p>According to your desciption </p>

<blockquote>
  <p>I just found out that I can still pull and deploy older images. But every new image I build cannot be pulled by the kubernetes pods.</p>
</blockquote>

<p>I assume you can pull docker image by command, but not kubectl.</p>

<pre><code>docker pull eu.gcr.io/my-gcp-project/my-image:v1.009 
</code></pre>

<p>So reference by this article <a href="https://container-solutions.com/using-google-container-registry-with-kubernetes/" rel="noreferrer">Using Google Container Registry with Kubernetes</a>, the authenication is differnet between pull docker image by <strong>docker pull</strong> and <strong>kubectl</strong> .  </p>

<p>Did you give access token to GKE?</p>

<pre><code>kubectl create secret docker-registry gcr-access-token \
--docker-server=eu.gcr.io \
--docker-username=oauth2accesstoken \
--docker-password="$(gcloud auth print-access-token)" \
--docker-email=any@valid.email
</code></pre>
