Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are good workflows for deploying podman/buildah created container images to minikube?

I am exploring and learning about containers and kubernetes using podman and minikube on a linux workstation. I use podman to build images on the workstation and would like to deploy these images in minikube also running on the workstation using the kvm2 virtual machine driver. I also start minikube using the CRI-O container runtime.

What are efficient workflows to deploy these images from the workstation to minikube in this scenario? Docker is not running on the minikube VM so the reusing the Docker daemon as described in the minikube documentation is not an option. Sharing the host file system with minikube also appears to not be viable at this time when using kvm2.

Is running a local registry that is visible to both the workstation and the minikube vm the best option? Answers to How to use local docker images with Minikube? and (Kubernetes + Minikube) can't get docker image from local registry appear to offer good solutions for configuring a local registry.

Would skopeo be a solution?

Edit: this is a nice post describing how to set up a registry using podman: https://computingforgeeks.com/create-docker-container-registry-with-podman-letsencrypt/

thank you

Brad

like image 875
Brad Smith Avatar asked Jan 19 '20 15:01

Brad Smith


1 Answers

Minikube documentation provides the foundation for a potential workflow at https://minikube.sigs.k8s.io/docs/tasks/docker_registry/. In order to use podman in lieu of docker I did the following

Start minikube, as instructed, with the --insecure-registry flag. I specifically use

minikube start --network-plugin=cni --enable-default-cni --bootstrapper=kubeadm --container-runtime=cri-o --cpus 4 --memory 4g --insecure-registry "192.168.39.0/24"

Enable the minikube registry addon.

minikube addons enable registry

Configure podman to use the insecure minikube registry by adding the registry to the insecure registries section of /etc/containers/registries.conf. This section now looks like

[registries.insecure]
registries = ['192.168.39.175:5000']

where 192.168.39.175 is the minikube ip. This ip may change following minikube restarts.

Follow the build, push and run commands in https://minikube.sigs.k8s.io/docs/tasks/docker_registry/ substituting podman for docker. This assumes the test-img container file exists.

Build: podman build --tag $(minikube ip):5000/test-img .

Push: podman push $(minikube ip):5000/test-img

Run: kubectl run test-img --image=$(minikube ip):5000/test-img

This worked but suffers from a serious complication: there is no apparent way at this time to set the IP address for the minikube VM when using kvm2. The IP will always be in the 192.168.39.0/24 subnet but that is the only certainty. Each time minikube is started the IP address of the registry will change which has significant implications for podman and the workflow in general.

More to come an another solution.

like image 101
Brad Smith Avatar answered Oct 21 '22 22:10

Brad Smith