I am having trouble pulling images from GCR ( pulled by my deployments ) I got ImagePullBackOff error.
I have followed this tutorial already, step by step.
https://container-solutions.com/using-google-container-registry-with-kubernetes/
However it doesn't seem to work for me. I have even tried using the Storage Admin role when creating the service account key but its still no use.
When describing the pod, I got this error:
Warning Failed 14s (x2 over 30s) kubelet, docker-for-desktop Failed to pull image "gcr.io/<project-name>/<image-name>": rpc error: code = Unknown desc = Error response from daemon: Get https://gcr.io/v2/<project-name>/<image-name>/manifests/latest: unknown: Unable to parse json key.
Warning Failed 14s (x2 over 30s) kubelet, docker-for-desktop Error: ErrImagePull
Normal BackOff 2s (x3 over 29s) kubelet, docker-for-desktop Back-off pulling image "gcr.io/<project-name>/<image-name>"
Warning Failed 2s (x3 over 29s) kubelet, docker-for-desktop Error: ImagePullBackOff
When visiting the https://gcr.io/v2/project-name/image-name/manifests/latest url, I got this:
// 20181124152036
// https://gcr.io/v2/project-name/image-name/manifests/latest
{
"errors": Array[1][
{
"code": "UNAUTHORIZED",
"message": "You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication"
}
]
}
Pod Definition:
apiVersion: apps/v1
kind: Deployment
metadata:
name: microservice-1-deployment
spec:
replicas: 3
selector:
matchLabels:
app: microservice-1
template:
metadata:
labels:
app: microservice-1
spec:
containers:
- name: microservice-1
image: gcr.io/project-name/image-name
ports:
- containerPort: 80
Notes:
My deployments are able to pull images when they where hosted on docker hub, issue only occurs on pulling images in GCR.
Env
I hope you can help me on this,
Thanks in advance
OK found the culprit, it has something to do with Powershell and Command Prompt.
I switched to using Git Bash and followed the same instructions in this tutorial
https://container-solutions.com/using-google-container-registry-with-kubernetes/
and it worked!
Probably the culprit occurred when creating imagePullSecrets on Powershell and/or Command Prompt. Something probably went wrong when reading the json file, related to encoding or something.
Hope this helps anyone.