Confusion with running Kubernetes Locally – Part 1
May 19, 2020
May 19, 2020
So you’ve been running your local development lately inside of Docker and you’re pretty comfortable. You’ve decided to get your feet wet with Kubernetes. You go to the Kubernetes website and you download Minikube, get all the tools going, and run through the tutorial. But then you look at Docker Desktop and you notice that it has the ability to run Kubernetes as well.
As you go through the Minikube tutorial, you get to where you create your service. So you type:
kubectl run SERVICE-NAME –image IMAGE-LABEL –port=80
kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
api-node 0/1 1 0 44s
What’s going on? So you run
kubectl get events
and you notice the following message:
Warning ErrImageNeverPull pod/NAME-5c5f4dc84b-fjnsc Container image “IMAGE-NAME” is not present with pull policy of Never
A container image is not present? You know it is there because you built out the container with Docker to test it out. The issue here is that Minikube has its own docker daemon. So if you are using Minikube, you need to run docker build using Minikube’s Docker.
So that when you the docker command, you run the Minikube version, you’ll need to run
eval $(minikube -p minikube docker-env)
Now you can build your container again and then run the ‘kubectl run’ command again and it will build out your pod with your image.
Advanced Data Engineering Platform for Cleansing, Preprocessing and Analytics