Reputation: 7996
I ran eval $(minikube docker-env)
then built a docker container. When I run docker images
on my host I can see the image. When I run minikube ssh
then docker images
I can see it.
When I try to run it, the pod fails to launch. kubectl describe pod
gives:
14m 3m 7 kubelet, minikube spec.containers{quoting-crab-customer-refresh-cache-cron} Normal Pulling pulling image "personalisation-customer:latest"
14m 3m 7 kubelet, minikube spec.containers{quoting-crab-customer-refresh-cache-cron} Warning Failed Failed to pull image "personalisation-customer:latest": rpc error: code = 2 desc = Error: image library/personalisation-customer:latest not found
14m 2s 66 kubelet, minikube Warning FailedSync Error syncing pod
14m 2s 59 kubelet, minikube spec.containers{quoting-crab-customer-refresh-cache-cron} Normal BackOff Back-off pulling image "personalisation-customer:latest"
My imagePullPolicy
is Always
.
What could be causing this? Other pods are working locally.
Upvotes: 10
Views: 15016
Reputation: 777
You can ssh to minikube using ssh
minikube ssh -p <profilename>
and then pull the image
docker pull <image>
Make sure the imagePullPolicy: IfNotPresent
and then run your deployment
Upvotes: 0
Reputation: 101
I had the same issue. Issue was not mentioning the image version. I used
kubectl run testapp1 --image=<image> --image-pull-policy=IfNotPresent
instead of,
kubectl run testapp1 --image=<image>:<version> --image-pull-policy=IfNotPresent
Upvotes: 2
Reputation: 13855
For minikube, make the changes as follows:
Eval the docker env using: eval $(minikube docker-env)
Build the docker image: docket build -t my-image
Set the image name as only "my-image" in pod specification in your yaml file.
Set the imagePullPolicy to Never in you yaml file. Here is the example:
apiVersion:
kind:
metadata:
spec:
template:
metadata:
labels:
app: my-image
spec:
containers:
- name: my-image
image: "my-image"
imagePullPolicy: Never
Upvotes: 2
Reputation: 18480
The local Docker cache isn't a registry. Kubernetes tries to download the image from Dockerhub (the default registry), since you set iMagePullPolicy
to Always
. Set it to Never
, so Kubernetes uses to local image.
Upvotes: 2
Reputation: 937
You aren't exactly pulling from your local registry, you are using your previously downloaded images or your locally builded, since you are specifying imagePullPolicy: Always
this will always try to pull it from the registry.
Your image doesn't contain a specific docker registry personalisation-customer:latest
for what docker will understand index.docker.io/personalisation-customer:latest
and this is an image that doesn't exist in the public docker registry.
So you have 2 options imagePullPolicy: IfNotPresent
or to upload the image to some registry.
Upvotes: 12