The easiest way to bootstrap a self-hosted High Availability Kubernetes cluster. A fully automated HA k3s etcd install with kube-vip, MetalLB, and more. Build. Destroy. Repeat.
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
[x] Tested locally
[x] Ran site.yml playbook
[x] Ran reset.yml playbook
[ ] Did not add any unnecessary changes
[x] Ran pre-commit install at least once before committing
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
site.yml
playbookreset.yml
playbook