Why is my GCP image failing to deploy to local kubernetes?

Viewed 45

I am getting "can't be pulled" when I use Cloud Code plugin in VS code to build and deploy an image to a local Kubernetes cluster. There are no errors being logged on GCP, but locally I'm getting the following:

 - deployment/<redacted> failed. Error: container <redacted> is waiting to start: gcr.io/<redacted>/<redacted>:latest@sha256:<redacted> can't be pulled.
2 Answers

If your GCR registry is a private registry then you need to configure your local Kubernetes cluster with an imagePullSecret to use to authenticate to GCR. The general process is to create a service account in your GCP project, and then configure the corresponding service account key file as the pull secret.

There are a variety of tutorials, and this one looks pretty good.

Can you try gcloud auth list and check if you are using the right account? To switch account use gcloud auth login <account>

Also make sure you have the right permission : gcloud permission to pull GCP image

Once these two things are in place then you should be able to pull the image for GCR.

Related