TroubleShoot - mnhmilu/poc-kubernets GitHub Wiki
Problem 1
kubectl create deployment hello-fastapi --image=registry.hub.docker.com/noahgift/fastapi-kube not working until i use minikube ssh docker pull , why this happening?
The issue you're facing could be related to the way Minikube manages Docker images. When you execute kubectl create deployment
command, Kubernetes attempts to pull the specified image from the container registry. However, if the image is not available locally on the Minikube VM, it needs to be pulled from the internet.
By default, the Docker daemon inside the Minikube VM has its own image cache separate from your local machine's Docker daemon. So, even if you have the image available locally on your machine, it may not be accessible within the Minikube VM.
To resolve this issue, you can follow these steps:
-
Start Minikube and ensure it is running:
minikube start
-
Access the Minikube VM using SSH:
minikube ssh
-
Once inside the Minikube VM, execute the Docker pull command to fetch the required image:
docker pull registry.hub.docker.com/noahgift/fastapi-kube
This will download the image into the Minikube VM's Docker cache.
-
Exit the Minikube VM by typing
exit
. -
Now, you should be able to create the deployment using the image that was pulled into the Minikube VM:
kubectl create deployment hello-fastapi --image=registry.hub.docker.com/noahgift/fastapi-kube
Kubernetes will use the image from the Minikube VM's Docker cache, allowing the deployment creation to proceed without needing to download the image from the internet.
This workaround ensures that the required image is available within the Minikube VM's Docker cache, enabling successful deployment creation without additional image pulls during the process.