Bootstrap an Air-Gapped Cluster
Introduction
This guide outlines the steps to bootstrap a Cozystack cluster in an air-gapped environment.
Air-gapped installation means that the cluster has no direct access to the Internet. All necessary resources, such as images and metadata, must be available on the private network.
Configuring Talos Nodes
For installing with Talm, it’s enough to make all mentioned changes once in ./templates/_helpers.tpl and then build the actual node configuration files with talm template.
For installing with talosctl, the changes should be made in patch.yaml and patch-controlplane.yaml.
1. Configure NTP Servers
Accurate time synchronization is critical for the cluster. In your Talos machine configuration, set local NTP servers that are accessible inside your private network:
machine:
time:
servers:
# example values
- 192.168.0.4
- 10.10.0.5
Ensure that these NTP servers are reachable from the first Talos node.
2. Configure Container Registry Mirrors
Since the cluster cannot access public container registries, it needs to use their local mirrors. Creating such mirrors is out of the scope of this guide.
Update your machine configuration in the following way, providing the IP addresses and ports of your local mirrors for each registry:
machine:
registries:
mirrors:
docker.io:
endpoints:
- http://10.0.0.1:8082
ghcr.io:
endpoints:
- http://10.0.0.1:8083
gcr.io:
endpoints:
- http://10.0.0.1:8084
registry.k8s.io:
endpoints:
- http://10.0.0.1:8085
quay.io:
endpoints:
- http://10.0.0.1:8086
cr.fluentbit.io:
endpoints:
- http://10.0.0.1:8087
docker-registry3.mariadb.com:
endpoints:
- http://10.0.0.1:8088
config:
"10.0.0.1:8082":
tls:
insecureSkipVerify: true
auth:
username: myuser
password: mypass
Of course, the values for config.[0].auth.* are given as examples, and you need to use real credentials.
Make sure your local registry proxies mirror all required images for Talos and Kubernetes components.
3. Add CA Certificate
To use a private Certificate Authority, you need to add its certificate to the nodes.
# talm: nodes=["10.10.10.10"], endpoints=["10.10.10.10"], templates=["templates/controlplane.yaml"]
# THIS FILE IS AUTOGENERATED. PREFER TEMPLATE EDITS OVER MANUAL ONES.
machine:
# ...
# ...
discovery:
enabled: false
etcd:
advertisedSubnets:
- 10.4.100.10/24
allowSchedulingOnControlPlanes: true
---
apiVersion: v1alpha1
kind: TrustedRootsConfig
name: my-enterprise-ca
certificates: |
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
4. Apply Changes
After you have made the changes above, you can apply the configuration and bootstrap a cluster:
Using Talm
Rebuild the node configuration files and apply them to each node:
talm template -e <ip> -n <ip> -t templates/controlplane.yaml -i > nodes/node1.yaml
talm apply -f nodes/node1.yaml
# repeat for each node
Finally, bootstrap the cluster as usual:
talm bootstrap -f nodes/node1.yaml
Read the Talm configuration guide to learn more.
Using talosctl
Apply the configuration to each node:
talosctl apply -f controlplane.yaml -n <ip> -e <ip> -i
Finally, bootstrap the cluster using one of the nodes:
talosctl bootstrap -n <ip> -e <ip>
Read the
talosctl configuration guide to learn more.
5. Configure Container Registry Mirrors for Tenant Kubernetes
Tenant Kubernetes clusters use Kamaji for the control plane. The control plane components run as pods on the management cluster nodes, so they already use the registry mirrors configured in step 2.
Tenant worker nodes run as separate virtual machines with their own Talos instance.
They are configured per worker pool, on the KubernetesNodes resource.
Nothing is inherited from the parent Kubernetes resource or from the management nodes, so set the fields below on every pool.
Of the talos.* fields on the Kubernetes resource, only talos.version is used, so mirror settings placed there have no effect.
A worker needs three things reachable without public egress: its OS disk image, the Talos installer, and the container images it pulls.
apiVersion: apps.cozystack.io/v1alpha1
kind: KubernetesNodes
metadata:
name: my-cluster-md0
spec:
cluster: my-cluster
talos:
# OS disk image, imported by CDI over HTTP
imageFactoryURL: https://factory.example.com
# only needed when the factory uses a certificate from an internal CA
imageFactoryCA: |
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
# installer image, resolved as <installerRepository>/<schematicID>:<version>
installerRepository: registry.example.com/installer
# rendered into the worker's machine.registries.mirrors
registryMirrors:
docker.io:
endpoints:
- http://10.0.0.1:8082
skipFallback: true
ghcr.io:
endpoints:
- http://10.0.0.1:8083
skipFallback: true
registry.k8s.io:
endpoints:
- http://10.0.0.1:8085
skipFallback: true
talos.imageFactoryURL(defaulthttps://factory.talos.dev) points at a self-hosted Image Factory, a caching mirror, or an internal HTTP file server. Settalos.imageFactoryCAto the PEM certificate of your internal CA if the factory is served over HTTPS with such a certificate, otherwise the import fails withx509: certificate signed by unknown authority.talos.installerRepository(defaultfactory.talos.dev/installer) must point at a registry that mirrors the Talos installer images.talos.registryMirrorstakes the samemirrorsmap as step 2. Use bare hosts as endpoints, as in step 2: Talos appends/v2to the endpoint path, so an endpoint likehttps://registry.example.com/v2/docker.ioonly works withoverridePath: trueadded to that host. By default Talos falls back to the upstream registry when the mirror fails, so setskipFallback: trueon every host to keep the workers off the public registries. There is no field formachine.registries.config, so a mirror on this list cannot require credentials or a custom TLS configuration.
machine.registries.mirrors is the containerd configuration of the whole worker node.
It covers the images Talos itself pulls, such as kubelet, and the images of pods running in the tenant cluster alike.
Changing talos.registryMirrors on an existing pool rolls all of its workers.
A pool that sets osImage.builtin clones its OS disk from the worker image catalog and ignores talos.imageFactoryURL and talos.imageFactoryCA.
The catalog imports its images on its own, from kubernetesWorkerImage.imageFactoryURL in the
platform package, so point that value at your factory as well.
registries value, which rendered the cozy-system/patch-containerd Secret.
Talos-based workers never read that Secret, so it has had no effect since v1.6, and both were removed in v1.7.1.
If you are upgrading from v1.5 and relied on patch-containerd, your tenant workers no longer use those mirrors: set talos.registryMirrors on each KubernetesNodes pool instead.