Run MicroK8s Entirely Self Hosted Registry

Hey I want to run microk8s in an environment that doesn’t allow external image pulls. It’s fine if I use the self hosted registry or local docker images for all that. But it spins up with defaults (as do the add-ons) that use external registries. (I’m in an entirely isolated network environment).

Any advice on how to run microk8s with all it’s system and add-on images hosted locally? I don’t even care if I have to pull them, copy them, and upload them myself (but it would be a pain, I’d have to grep out the images from kubectl get all , and script it ).

That still doesn’t solve my problem of the thing bootstrapping itself with outside images though. I wonder if there’s any way to configure the default snap manifests, so if at least the images were local, it could use those?

Or any other creative ideas :slight_smile: This is kind of a poc and stopgap until I can move to something like EKS.

Thanks for your advice


The basic image you need is definitely the pause container image. This is by default defined in the /var/snap/microk8s/current/args/containerd.conf.template.

Next you need to grab the Calico cni. if you head out to MicroK8s github repo, the cni yaml is located here - microk8s/upgrade-scripts/000-switch-to-calico/resources at master · ubuntu/microk8s · GitHub. During runtime, it will be located in /var/snap/microk8s/current/args/cni-network/.

Up next is the DNS, you can either install your own coredns with all the images modified. If you want to see the coredns manifest used by MicroK8s, head over here microk8s/coredns.yaml at master · ubuntu/microk8s · GitHub

Not all addons are created equal. Some uses helm charts which are pointing to external registries. This more difficult to tweak.

You can also try building your own MicroK8s snap and install it to your lab. From there you can change where the image registries are pointed for the addons that you need.

Build instructions are here microk8s/ at master · ubuntu/microk8s · GitHub

Hope this helps.

1 Like

Hi balchua1,

This is super helpful information, thanks so much for taking the time to spell it out and give me different options. I definitely have a path forward now; very much appreciated.

Great to know I can fall back on building my own snap - I hadn’t considered that, but now that you mention it, it gives tons of flexibility.

And I’d probably have taken quite a while to notice the add-on variation - so you saved me hours or days there too.

Thanks again, and take care.

1 Like