-
-
Notifications
You must be signed in to change notification settings - Fork 504
Description
Is your feature request related to a problem or a Pull Request
No, but I have an unregistered issue discussed with @iwilltry42 on Slack. 😉
Scope of your request
We are "stranded" in a semi air-gapped environment, where all container images must be pulled through an internal registry proxy (Artifactory). This means that all Internet image urls must be re-written, either explicitly or indirectly using some kind of mirroring configuration.
This was causing some initial challenges when we adopted k3d, but since k3s (using containerd) allows us to configure mirrors for all images pulled from within the cluster, we were almost able to work around the problems. We were still having issues with pulling the k3d images (k3d-proxy and k3d-tools), but the last piece in the puzzle was landed supplying the --registry-mirror Docker setting - allowing us to pull the k3d images through our on-prem proxy - as long as they were hosted on DockerHub.
But after k3d became an independent project, these images are now hosted by ghcr.io. And that blocks our current workaround, since Docker only allow you to configure a mirror for DockerHub itself:
It’s currently not possible to mirror another private registry. Only the central Hub can be mirrored.
Here is the relevant code i k3d:
Lines 48 to 64 in f2df55a
| func GetLoadbalancerImage() string { | |
| if img := os.Getenv(K3dEnvImageLoadbalancer); img != "" { | |
| l.Log().Infof("Loadbalancer image set from env var $%s: %s", K3dEnvImageLoadbalancer, img) | |
| return img | |
| } | |
| return fmt.Sprintf("%s:%s", DefaultLBImageRepo, GetHelperImageVersion()) | |
| } | |
| func GetToolsImage() string { | |
| if img := os.Getenv(K3dEnvImageTools); img != "" { | |
| l.Log().Infof("Tools image set from env var $%s: %s", K3dEnvImageTools, img) | |
| return img | |
| } | |
| return fmt.Sprintf("%s:%s", DefaultToolsImageRepo, GetHelperImageVersion()) | |
| } |
Describe the solution you'd like
I would like to see an opt-in for some registry override/mirror to pull the k3d images, similar to what k3s provides. We are currently pulling cluster workload images from ghcr.io (and a lot of other Internet image registries), so we supply registries config to k3d, that works:
registries:
config: |
mirrors:
docker.io:
endpoint:
- dockerhub-docker-remote.hub.mycompany.com
gcr.io:
endpoint:
- gcr-docker-remote.hub.mycompany.com
ghcr.io:
endpoint:
- ghcr-docker-remote.hub.mycompany.comMy preferred solution would be if k3d could use this config to eventually use a mirror configured for k3s to pull it's internal images from ghcr.io. The mirror should only be used if the mirror key matches ghcr.io exactly. There are a few other options that can be configured in k3s registries.yaml (certificates, authentication etc.), but I am not sure if all have to be supported from day one?
An alternative solution could be to allow for configuring image registry (or image repositories) in the k3d specific config. In our case a registry would be the simplest, and sufficient. And that would make it correspond to the k3s settings - more or less. But some users may want to override the image repositories (one per image), and that would also work for us - but will require more configuration.
An idea on how this might fit into the configuration file:
options:
k3d: # k3d runtime settings
imageRegistry: ghcr-docker-remote.hub.mycompany.comDescribe alternatives you've considered
We can override the full image URLs, including the version tag, using the environment variables K3D_IMAGE_LOADBALANCER and K3D_IMAGE_TOOLS, and we probably will do for now - as a workaround. But that clutters our configuration of k3d IMO, and we would have to sync the version bumps.