Published
This resource is part of the Syself Autopilot 1.37 release. For the whole picture, see what's new in 1.37.
When a node is drained during an upgrade, its pods move to other nodes. Those nodes may need to download the same container images again, even if another node in the cluster already has them. That's where a peer cache like Spegel helps. It lets nodes share container image layers directly with each other instead of downloading everything from an external registry.
There's one challenge with running Spegel on Syself Autopilot. Every node uses a sealed, read-only OS, so Spegel cannot modify its own containerd configuration.
Syself Autopilot 1.37 makes this possible with the new containerdRegistryHostsSecretRef variable. Spegel is not part of the Cluster Stack. You install and run it yourself, and the variable lets the platform point containerd on every node at it. We set it up on a test cluster to see how it behaves. Here's how it works and what we found.
We created a small Syself Autopilot 1.37 cluster with one control plane and two worker nodes. All three nodes were Hetzner Cloud cpx32 servers in the same location, and we installed Spegel 0.8.2. To test different image sizes and registries, we pulled four public images:
| Image | Registry | Compressed size |
|---|---|---|
python:3.13-slim | public.ecr.aws | 43 MB |
node:22 | public.ecr.aws | 409 MB |
home-assistant:stable | ghcr.io | 674 MB |
jupyter/pytorch-notebook | quay.io | 1.55 GB |
Before each test, we removed the images and their layers from both workers. This ensured that every pull started without a local copy.
The setup has two parts. First, configure containerd to send image requests to Spegel. Then install Spegel with its own containerd configuration disabled.
Start by creating a hosts.toml file that points every registry to Spegel's port on the local node:
[host."http://127.0.0.1:30020"]
capabilities = ["pull", "resolve"]
By default, the platform places this file in the _default folder on each node. This means it applies to every registry without its own configuration. The address points to Spegel's NodePort, which listens on port 30020 on every node.
Create a Secret from the hosts file in the cluster's namespace on the management cluster:
$ kubectl -n <namespace> create secret generic containerd-registry-hosts \
--from-file=hosts.toml=hosts.toml
Add the containerdRegistryHostsSecretRef variable to your Cluster:
spec:
topology:
variables:
- name: containerdRegistryHostsSecretRef
value:
enabled: true
name: containerd-registry-hosts
Changing this variable replaces every node, including control-plane nodes. Once the rollout finished, every node had the file at /etc/containerd/certs.d/_default/hosts.toml. The node image keeps its own entry for registry.k8s.io.
Now install Spegel with its containerd configuration disabled:
$ helm upgrade --install spegel oci://ghcr.io/spegel-org/helm-charts/spegel \
--namespace spegel --create-namespace \
--set spegel.containerdMirrorAdd=false
This setting is important. By default, Spegel's init container tries to write to the node's containerd configuration. Because the OS is read-only, it fails with:
mkdir /etc/containerd/certs.d/_backup: read-only file system
Setting spegel.containerdMirrorAdd=false prevents this. The DaemonSet can then start on every node, and containerd reaches Spegel through a NodePort.
Spegel mounts the containerd socket and image store from the host. If you enforce Pod Security Standards, keep the spegel namespace at the privileged level.
You can check the services with:
$ kubectl -n spegel get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
spegel ClusterIP 10.129.244.118 <none> 9090/TCP 9s
spegel-bootstrap ClusterIP None <none> <none> 9s
spegel-registry NodePort 10.136.219.155 <none> 5000:30020/TCP 9s
The important service is spegel-registry. It exposes port 30020 on every node, matching the address in our hosts file.
Once everything is running, here's what happens when a pod requests ghcr.io/acme/app:v1:
certs.d/ghcr.io/ directory on the node. If it doesn't find one, it uses _default/hosts.toml.http://127.0.0.1:30020 to resolve and pull the image. Spegel checks whether another node already has the image layers.ghcr.io as usual. The node can then share the image with other nodes.Our guide Use a registry mirror or peer cache explains the setup in more detail, including network policies and Pod Security.
Subscribe to The Syselfer, our newsletter, or add the RSS feed to your reader.
When another node already had an image, the pulling node retrieved its layers from inside the cluster. We counted the bytes transferred through each node's network interfaces. Traffic from other nodes arrives through the cluster's overlay network, while traffic from the internet does not. In 10 of 12 pulls, every layer came from another node. In the remaining 2 pulls, some layers still came from the registry.
We created a Deployment with three replicas of node:22 on one worker and drained that node. The other worker didn't have a copy of the image. We repeated the test with pytorch-notebook. In both cases, most of the image came from the drained node, but the pods didn't become ready any sooner than without Spegel.
We tested this by placing an image in a registry that only one worker could reach. After pulling the image on that worker, we deleted the registry and tried pulling the same image on the other worker. The pull succeeded, and every layer came from the first worker. We also tried pulling an image that no node had downloaded before. That pull failed with a NotFound error.
Spegel can only serve images that at least one node already has.
We scaled the worker pool from two to three nodes. The new node received the hosts file during its first boot, and its Spegel pod became ready shortly after the node joined. We then pulled node:22 and pytorch-notebook. Both images came from other nodes, with no traffic from the internet.
Our tests showed two practical benefits of Spegel:
Spegel changes where image layers come from, not how long containerd takes to unpack them. For larger images, unpacking takes most of the pull time, so don't expect pods to start noticeably faster.
The hosts file is part of the node's boot configuration. Enabling or disabling the variable replaces all nodes, including control-plane nodes. Editing the Secret alone doesn't update running nodes. New nodes receive the Secret's current content when they're created. This means nodes can end up with different hosts files if you edit the Secret without replacing existing nodes. To roll out an updated hosts file, create a Secret with a new name and update the variable's name field.
The platform reads the Secret whenever it creates a node. If the Secret doesn't exist, new nodes cannot finish provisioning. Create the Secret before enabling the variable.
Spegel's cache listens on port 30020 on every node. Without a network policy restricting access, anyone who can reach a node on that port can pull cached images, including private images. See Use a registry mirror or peer cache for details.
Spegel doesn't check image pull secrets. Once a node pulls a private image, a pod on any node can retrieve it from the cache without a pull secret. This also applies when using imagePullPolicy: Always. If teams in your cluster must not be able to access each other's images, don't use a peer cache.
Start with a trial, and our step-by-step guides will walk you through your first cluster deployment in minutes.
Tags
Syself Autopilot 1.37 adds a unikernel RuntimeClass (tech preview) that boots OCI-packaged unikernels in their own QEMU/KVM VMs on bare-metal nodes, while keeping normal Kubernetes networking and Services.
1.36 rebuilds the node OS as Syself Linux, installs nodes with a new provisioner, and runs Syself's own failover proxy, tunnel, and KubeGate for the control-plane path. Read the highlights, the full notes by area, and the upgrade steps.
Syself Autopilot 1.36 runs an immutable Kubernetes node OS, built from source and then sealed and verified block by block, so you can prove what a node runs.