Install and use the private registry in the Microk8s integrator

Tram Ho

First, the system I guide in the series will deploy in a VM environment and the images will not be public to the Internet, so I use the private registry.

Activate the registry

I ssh into the VM stg-02 ( to execute, the child role stg-02 is currently playing the Master role.

After successfully logging into stg-02, we proceed to activate the registry with the command


After activating the registry, the default persistent volume is 20G to store images, but you can add more to suit your application.

How to use Private Registry

  1. Install Docker Engine on ubuntu 22.04 (you can refer to the source )
  • Uninstall old version

Set up repository

  • Update the apt package index and install the packages to allow apt to use the repository over HTTPS: sudo apt-get update sudo apt-get install ca-certificates curl gnupg lsb-release
  • Add Docker’s official GPG key:

  • Use the command to set up the repository

Install Docker Engine

  1. Update apt packages

  1. Install Docker Engine, containerd, and Docker Compose.

Configure Insecure registry (Allow push images without SSL)

On the build machine and push machine from Docker we need to add the configuration in the file /etc/docker/daemon.json

add config snippet


Save and restart the docker service

Now we test the configuration according to the steps:

  1. Pull image Nginx


  1. tag file image nginx ->


  1. Push image to registry


Microk8s . Configuration

Microk8s 1.23 and later use separate hosts files for each image registration. For the Registry , the configuration file will be at /var/snap/microk8s/current/args/certs.d/

First, create the directory and folder if it doesn’t exist:

Then edit the file you just created and make sure it’s correct as follows:


Save and restart the microk8s service

Deploy and test new image push

  1. Create file big-dog-nginx-all.yaml

  1. Run file big-dog-nginx-all.yaml


There are 2 ways to test:

  1. Go to port 30039 to check:


  1. run dashboard to check



If you find this post helpful, please give me a like and subscribe to support me. Thank you so much ♥️♥️♥️♥️

Link github for you to copy quickly

Share the news now

Source : Viblo