kubernetes/minikube

add --registry-mirror support for Containerd Runtime

Open

#18,361 opened on Mar 11, 2024

View on GitHub
 (4 comments) (0 reactions) (1 assignee)Go (31,799 stars) (5,222 forks)batch import
help wantedkind/featurepriority/important-soon

Description

we have support for registry-mirror for docker runtime but not for containerd:

I did this

$ minikube start --container-runtime=containerd --registry-mirror=http://localhost:5000

and then $ minikube ssh $ docker@minikube:~$ ls /etc/containerd/certs.d/
docker.io

According to Gemini to add registry mirror to containerd,


Locate the containerd Config File:
This is usually found at /etc/containerd/config.toml. If it doesn't exist, you'll need to create it.

Modify/Add the plugins."io.containerd.grpc.v1.cri".registry Section:

Version 1.6 and newer:
Make sure this section has plugins."io.containerd.grpc.v1.cri".registry.config_path = "/etc/containerd/certs.d" set.
Create a hosts.toml file within /etc/containerd/certs.d/registry-to-mirror.com, replacing 'registry-to-mirror.com' with the actual registry hostname you want to mirror (e.g., docker.io).
Ini, TOML
server = "https://registry-1.docker.io"  # Original registry (if needed)

[host."https://my-local-mirror.com"]
capabilities = ["pull", "resolve"] 
Use code [with caution.](https://gemini.google.com/faq#coding)


In the code I see we only Start the Docker Container runtime in the provisioner with the registry mirror: https://github.com/medyagh/minikube/blob/375d9c6cbf6d33a1c20d91c886f7f19c5d8b52c2/pkg/provision/ubuntu.go#L111

Contributor guide