The standard Hello-World app as available on https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app does not work. There appears to be some pull access issue, despite the fact that things should work right off the box when working with Kubernetes on GCP in combination with the Google Cloud.
For instance reference: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod
which mentions:
"Using Google Container Registry Kubernetes has native support for the Google Container Registry (GCR), when running on Google Compute Engine (GCE). If you are running your cluster on GCE or Google Kubernetes Engine, simply use the full image name (e.g. gcr.io/my_project/image:tag). All pods in a cluster will have read access to images in this registry.
I double checked that I used the right image name (copy pasted it from container registry).
Error message:
C:\Users\rober>kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-web-694bc87958-rcdvg 0/1 ImagePullBackOff 0 7s
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 7m default-scheduler Successfully assigned default/hello-web-694bc87958-rcdvg to gke-hello-cluster-default-pool-9cbfb505-588j
Normal SandboxChanged 7m (x3 over 7m) kubelet, gke-hello-cluster-default-pool-9cbfb505-588j Pod sandbox changed, it will be killed and re-created.
Normal BackOff 7m (x6 over 7m) kubelet, gke-hello-cluster-default-pool-9cbfb505-588j Back-off pulling image "gcr.io/data-platform-tst/hello-app:v1"
Normal Pulling 6m (x3 over 7m) kubelet, gke-hello-cluster-default-pool-9cbfb505-588j pulling image "gcr.io/data-platform-tst/hello-app:v1"
Warning Failed 6m (x3 over 7m) kubelet, gke-hello-cluster-default-pool-9cbfb505-588j Failed to pull image "gcr.io/data-platform-tst/hello-app:v1": rpc error: code = Unknown desc = Error response from daemon: repository gcr.io/data-platform-tst/hello-app not found: does not exist or no pull access
Warning Failed 6m (x3 over 7m) kubelet, gke-hello-cluster-default-pool-9cbfb505-588j Error: ErrImagePull
Warning Failed 2m (x24 over 7m) kubelet, gke-hello-cluster-default-pool-9cbfb505-588j Error: ImagePullBackOff
Best Answer
Please make sure that you have the proper scopes set up within your cluster for the service account to pull the image. Please follow the Official Documentation that provides step-by-step instructions on how to grant users permission to pull an image from a Container Registry.
I understand that you are using Google Container Registry so in this case, GKE nodes already have access to the Google Container Registry images in the same Google Cloud Platform project as the cluster.
So please check the scope you have given to your cluster.
Follow the next steps or the Official Documentation: