Deploy to K3D without container registry#
In my evergoing quest to be as independent as possible, I like to try Kubernetes apps locally. K3D already helps with running Kubernetes apps locally, however when I want to use my own Dockerfiles, I suddenly need some container registry to install things on it with the default values. So here are things I did to avoid that
Build and Import Docker Images#
First you need to build a Dockerfile with docker build --tag <tagname> -f
Dockerfile .
. The <tagname>
is important, because it’s a reference when
you want to import the image into your k3d cluster with k3d image import
<tagname> -c <clustername>
.
Configuration your K8s specs#
Whether you are using Kustomize or Helm files, you need to refer to the image
by the same <tagname>
. Futhermore, the imagePullPolicy
should be set to
ifNotPresent
.
Now when you kubectl apply
or helm install
your files, the container image
you’ve built earlier will be used and no attempts will be made to find the
image on a remote container registry.