<p>I have a Kubernetes cluster in Digital Ocean, I want to pull the images from a private repository in GCP.</p>
<p>I tried to create a secret that make me able to to pull the images following this article <a href="https://blog.container-solutions.com/using-google-container-registry-with-kubernetes" rel="nofollow noreferrer">https://blog.container-solutions.com/using-google-container-registry-with-kubernetes</a></p>
<p>Basically, these are the steps</p>
<ol>
<li>In the GCP account, create a service account key, with a JSON credential</li>
<li>Execute
<pre><code>kubectl create secret docker-registry gcr-json-key \
  --docker-server=gcr.io \
  --docker-username=_json_key \
  --docker-password=&quot;$(cat ~/json-key-file.json)&quot; \
  --docker-email=any@valid.email
</code></pre>
</li>
<li>In the deployment yaml reference the secret
<pre><code>imagePullSecrets:
  - name: gcr-json-key
</code></pre>
</li>
</ol>
<p>I don't understand why I am getting 403. If there are some restriccions to use the registry outside google cloud, or if I missed some configuration something.</p>
<blockquote>
<p>Failed to pull image &quot;gcr.io/myapp/backendnodeapi:latest&quot;: rpc error: code = Unknown desc = failed to pull and unpack image &quot;gcr.io/myapp/backendnodeapi:latest&quot;: failed to resolve reference &quot;gcr.io/myapp/backendnodeapi:latest&quot;: unexpected status code [manifests latest]: 403 Forbidden</p>
</blockquote>

<p>Verify that you have enabled the Container Registry API, Installed Cloud SDK and Service account you are using for authentication has <a href="https://cloud.google.com/container-registry/docs/access-control" rel="nofollow noreferrer">permissions</a> to access Container Registry.</p>
<p>Docker requires privileged access to interact with registries. On Linux or Windows, add the user that you use to run Docker commands to the Docker security group.
This <a href="https://cloud.google.com/container-registry/docs/advanced-authentication#prereqs" rel="nofollow noreferrer">documentation</a> has details on prerequisites for container registry.</p>
<p><strong>Note</strong>:
Ensure that the version of kubectl is the <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#install-kubectl-binary-with-curl-on-linux" rel="nofollow noreferrer">latest version</a>.</p>
<p>I tried replicating by following the document you provided and it worked at my end, So ensure that all the prerequisites are met.</p>
