Ben
Ben

Reputation: 5087

Unable to pull images from GCR in k8s/minikube

When my pods start, they fail with Failed to pull image "gcr.io/myproject/backend:staging": rpc error: code = Unknown desc = Error response from daemon: pull access denied for gcr.io/myproject/backend, repository does not exist or may require 'docker login'

This is happening on minikube, despite the fact that (I believe) I have correctly created the service account in GCP, created a Secret based on the downloaded key in the namespace the pods are in, and patched the default service account, i.e.,

kubectl --namespace=staging create secret docker-registry gcr-json-key --docker-server=https://gcr.io --docker-username=_json_key --docker-password="$(cat ~/Downloads/gcr-read-key.json)" [email protected]
kubectl --namespace=staging patch serviceaccount default -p '{"imagePullSecrets": [{"name": "gcr-json-key"}]}'

Examining the GCR images web view shows the repo and an image with the specified tags.

I've also tried adding the imagePullSecrets entry in the deploy file to no good effect.

Upvotes: 0

Views: 1426

Answers (1)

wolmi
wolmi

Reputation: 1709

You need to add to your service account a rol to access the storage on GCS, at the end the registry is on top of a bucket

Upvotes: 3

Related Questions