Hi,
For my projects, I want MicroK8s to only pull images from my private registry and avoid downloading from Docker Hub or other public registries.
I’m using MicroK8s v1.31.2 and have set up an external Harbor registry. I followed the steps in the registry-private documentation for version 1.23 or newer, including configuring the daemon.json file with the mirror settings. However, when I restart MicroK8s, I encounter these issues:
MicroK8s fails to pull images from my registry.
Public registries still seem to be accessible.
The harbor is a insecure registry (http) and is well configured because i can use it with docker but i must to specify the url as docker pull 192.168.1.140:5280/myprojectname.io/nginx:latest
I tried to make a mirror from docker. io to my registry to specify the images on my .yaml files
It works if i specify the image full url as on docker example, but i dot want to specify on all my pods or services the same url. I want they to be more dynamic.
Im missing something?
Can someone help or guide me on the proper way to enforce a private registry with MicroK8s and harbor?
Hi, I am using Harbor as a local registry to generate Kubernetes cluster, if I understand your question correctly, I think you should check with these commands.
curl -v https://<your-registry-domain>/v2/
Enable microk8s registry
AND
kubectl create secret docker-registry <secret-name> \
--docker-server=<your-registry-domain> \
--docker-username=<username> \
--docker-password=<password> \
--docker-email=<email>
In this path /etc/docker/daemon.json
{
"insecure-registries": ["<your-registry-domain>"]
}
Apply the same configuration to MicroK8s by editing /var/snap/microk8s/current/args/containerd-template.toml. Add this in [plugins.“io.containerd.grpc.v1.cri”.registry.mirrors]