Using minikube to pull image from local Docker registry (with self-signed CA certificate)
I'd like to be able to run minikube so that it can access a local docker registry using a self signed CA certificate. Ideally the process should be automated so that I can use a *deployment.yaml
file to pull the required image without intervention.
At the moment I'm using a workaroud as follows:
#ssh into the minikube instance
sudo minikube ssh
#create a folder for the certificate
sudo mkdir /etc/docker/certs.d/dave.local:5000
#copy the crt file from the registry computer to the minikube instance
sudo scp user@192.168.1.2:/home/dave/certs/domain.crt /etc/docker/certs.d/dave.local:5000
#then check login
docker login dave.local:5000
#then pull image so that it's already in minikube
docker pull dave.local:5000/davedockerimage
I then edit the *deployment.yaml
with imagePullPolicy: Never
. When I then run sudo kubectl create -f dave-deployment.yaml
it finds dave.local:5000/davedockerimage
locally on minikube it uses the already pulled image.
If imagePullPolicy: Always
. The image pull fails in minikube.
I've been through a range of tutorials/stack overflow answers and have been unable to crack this. Any help appreciated.
As a alternative for using self signed certificate in minikube you can start minikube with insecure-registry option like below:
minikube start --insecure-registry="dave.local:5000"