Background Context
Earlier today I was beginning to port our Presto cluster into kubernetes. So, the first thing I did was containerize Presto and try to run it in a kubernetes deployment in minikube (locally).
I’m fairly new to minikube. So far, I’m running it with vm-driver=None so that it uses the local docker instance rather than a virtualbox VM/etc.
The Error
So, I got my docker image building well and tested it within docker itself. That all worked great. Then I wrote my kubernetes deployment and ran it using the image… but unfortunately, it came up with the pod saying Error: ImagePullBackOff.
I went down a rabbit hole for a while after this because many posts talk about how to enable your minikube to have access to your local docker repo. But when you’re running vm-driver=None, you are literally running in your local docker – so it should already have access to everything.
The actual error is: “Failed to pull image “qaas-presto:latest”: rpc error: code = Unknown desc = Error response from daemon: pull access denied for qaas-presto, repository does not exist or may require ‘docker login’: denied: requested access to the resource is denied”.
So, the issue is that it’s trying to do a pull and it can’t find the image… but it shouldn’t need to pull because the image already exists locally as it was built locally.
Workaround
I found the workaround in this github entry: https://github.com/kubernetes/minikube/issues/2575. Basically, in your deployment/pod spec/whatever, you just set:
imagePullPolicy: Never
This makes it avoid trying to pull the image, so it never fails to find it. It just assumes it is present, which it is, and it uses it and moves on. You may not necessarily want to deploy your config to production with these settings, but you can always template them out with helm or something, so it’s a viable workaround.