Add minimal read only registry support #8554
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Adds a read-only docker image registry to the K3s server, this improves the experience for air-gapped K3s users and removes the need to pre-load containerd with images from the
agent/images/
directory.Types of Changes
New feature
Verification
Populate the
/var/lib/rancher/k3s/server/registry/
directory with a container image and pull the container from the server.and manually:
Testing
None
Linked Issues
User-Facing Change
NONE
Further Comments
This is designed to improve the experience bootstrapping an air gapped cluster, during both the initial install and reboots.
If the cluster is self hosted, you need to bootstrap a registry and the backing store, this solves that problem without having to load all of the artefacts at every K3s restart.
The registry is very simple, and was based of the
/static/
path route. Each repo requires two directories:manifests
andblobs
, the manifests are JSON files with.mediaType
specifying theContent-Type
, so the patch reads the manifests and provides the correctContent-Type
header. Otherwise it tries to respond with theAccept
header.Reading the entire manifest file could be a problem, however the cluster operator is responsible for the content of that directory.
This requires some documentation to be useful, and a helper script to populate the registry, I've created a stand alone example, documentation and a registry population script here: https://github.com/adrianmoye/minimal-registry/ I'm not sure what to do with this.