When I try to run a container in the cluster, I get a message "deployment test created" but when I look at the dashboard I can see that its in an error state (Failed to pull image..., it was not able to pull the image from the local minikube docker env due to authorization issues
My steps were:
--insecure-registry switch to 10.0.0.0/8, also tried 0.0.0.0/0 - Kubernetes version 1.9.0 also tried 1.8.0docker env to the minikube docker via minikube docker-env | Invoke-Expressionkubectl run test --image test-service --port 1101This is the result:
What am I missing?
Set the following property within the container definition:
imagePullPolicy: IfNotPresentExample:
...
containers:
- name: podhealthexample
image: podhealth-pod-a:latest
ports:
- containerPort: 80
imagePullPolicy: IfNotPresentThis also happened with me, it is important to check the policy to send retrieve your image, there are some ways as described in some forums, you can start your minikube by setting a registry of your preference as below, being a path.
$ minikube start --cpus 2 --disk-size 50g --memory 5000 --insecure-registry your.registry.com:5000another way is at the beginning of your minikube to present the environment variables through the docker-env, as follows and generate build of your image after the command.
$ eval $(minikube docker-env)another alternative is to import the image to existing through the docker load.
As discussed in the comments, openfaas/faas-netes issue 135 illustrates a similar issue, and mention as a possible solution:
imagePullPolicyif not mentioned should have defaulted toNeverinstead ofAlways.
The OP Tim Jarvis realized then:
I realized it was not an auth issue, but that it was always wanting to pull from an external repo.
The fix for me was to use theimagePullPolicyofIfNotPresent.