Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for custom registries / mirrors #382

Merged
merged 1 commit into from
Oct 18, 2023
Merged

Add option for custom registries / mirrors #382

merged 1 commit into from
Oct 18, 2023

Conversation

balazshasprai
Copy link
Contributor

@balazshasprai balazshasprai commented Oct 16, 2023

Proposed Changes

Added support for custom, private registries in k3s, according to their documentation.
(Got inspired after getting rate limited by docker hub at work..)

As I've documented in the sample/all.yml comments, it could be useful if you're getting rate limited (for example by running your CI/CD jobs over and over in your cluster), or you're in an air-gapped environment where you don't have Internet access after the initial setup, or if you're bandwidth limited.
If you've set up a private registry (for example using Sonatype Nexus, or Docker's Registry image, or Harbor),
to act as a "pull-through cache" as docker calls it, you can specify and override those docker.io / quay.io / ghcr.io endpoints with your own in /etc/rancher/k3s/registries.yaml.

Doing that also allows you to use your actual private registry, the one that stores your images, without having to store registry credentials in a secret and using imagePullSecrets in your deployments.

Of course you don't have to cache / proxy the docker.io / quay.io / ghcr.io images if you don't want / need to, you can just use this to add only your private registry.

I've tested both the caching and the private registry parts using my Harbor instance, works flawlessly.

Edit: I didn't add an "undo part" for the reset playbook, because the /etc/rancher/k3s dir gets cleaned up already.

Checklist

  • Tested locally
  • Ran site.yml playbook
  • Ran reset.yml playbook
  • Did not add any unnecessary changes
  • Ran pre-commit install at least once before committing
  • 🚀

@timothystewart6
Copy link
Contributor

This is awesome, thank you so much!

@timothystewart6 timothystewart6 enabled auto-merge (squash) October 18, 2023 02:08
@timothystewart6 timothystewart6 merged commit 505c2ee into techno-tim:master Oct 18, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants