kubernetes / minikube

Run Kubernetes locally
https://minikube.sigs.k8s.io/
Apache License 2.0
29.08k stars 4.86k forks source link

add --registry-mirror support for Containerd Runtime #18361

Open medyagh opened 5 months ago

medyagh commented 5 months ago

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

NeerajNagure commented 5 months ago

I would like to work on this

NeerajNagure commented 5 months ago

/assign

medyagh commented 5 months ago

@NeerajNagure thank you ! look forward to see your contribution

NeerajNagure commented 5 months ago

@medyagh I have linked a pr that sets containerd runtime options analogous to that of crio runtime.Can I know whether the environment variable CONTAINERD_MINIKUBE_OPTIONS is correct or not? Also whether my approach to add support is correct or not?