Am using minikube
to test out the deployment and was going through thislink
And my manifest file for deployment is like
apiVersion: ext
Check your
kubectl version
Be sure the client version is up to date with the daemon(Server) version. Read below quote from the official docs
You must use a kubectl version that is within one minor version difference of your cluster. For example, a v1.2 client should work with v1.1, v1.2, and v1.3 master. Using the latest version of kubectl helps avoid unforeseen issues.
You need to use eval $(minikube docker-env)
in your current terminal window. This will use the minikube docker-env for the current session.
The image needs to be on the minikube virtual machine. So now you need to build your image again.
But be careful ! Don't use sudo when building the image. It won't use the minikube docker-env.
After you close the terminal, everything will be as it was before.
Then, use imagePullPolicy: Never
in the manifest file to use the local image registry.
Example:
apiVersion: v1
kind: Pod
metadata:
name: demo
spec:
containers:
- name: demo
image: demo
imagePullPolicy: Never # <-- here
ports:
- containerPort: 3000
When using a single VM for Kubernetes, it’s useful to reuse Minikube’s built-in Docker daemon. Reusing the built-in daemon means you don’t have to build a Docker registry on your host machine and push the image into it. Instead, you can build inside the same Docker daemon as Minikube, which speeds up local experiments.
The following command does the magic
eval $(minikube docker-env)
Then you have to rebuild your image again.
for imagePullPolicy: Never
the images need to be on the minikube node.
This answer provide details
local-images-in minikube docker environment