This repository provides Packer templates and scripts to build Talos OS images. You can build images for master nodes, worker nodes, or custom images with specific NVIDIA drivers.
- Packer installed
- Access to required base images and credentials (if needed)
To build images for master nodes, use the masters-talos-build.pkr.json.pkr.hcl template:
packer build masters-talos-build.pkr.json.pkr.hclTo build images for worker nodes, use the workers-talos-build.pkr.json.pkr.hcl template:
packer build workers-talos-build.pkr.json.pkr.hclIf you need a custom image with NVIDIA drivers, use the talos-custom-nvidia-build.pkr.json.pkr.hcl template:
packer build talos-custom-nvidia-build.pkr.json.pkr.hclThe script scripts/06-talos-image-builder.sh can create an image cache file (image-cache.oci or image-cache-cp.oci) containing required container images for Talos builds.
How it works:
- The script checks if the
CPvariable is set totrue.- If
CP=true, it createsimage-cache-cp.ociand includes all default Talos images plus:docker.io/coredns/coredns:1.12.2quay.io/cilium/cilium:v1.17.6quay.io/cilium/cilium-cli-ci:latestquay.io/cilium/operator-generic:v1.17.6
- Otherwise, it creates
image-cache.ociand includes only the default Talos images forkubelet,installer, andpause, plus:docker.io/coredns/coredns:1.12.2quay.io/cilium/cilium:v1.17.6nvcr.io/nvidia/k8s-device-plugin:v0.17.2
- If
Relevant script section:
# Create image-cache.oci or image-cache-cp.oci
echo "Creating image cache..."
if [ "$CP" = true ]; then
IMAGE_CACHE_PATH="./image-cache-cp.oci"
DEFAULT_IMAGES=$(talosctl images default)
EXTRA_IMAGES=(
"docker.io/coredns/coredns:1.12.2"
"quay.io/cilium/cilium:v1.17.6"
"quay.io/cilium/cilium-cli-ci:latest"
"quay.io/cilium/operator-generic:v1.17.6"
)
else
IMAGE_CACHE_PATH="./image-cache.oci"
DEFAULT_IMAGES=$(talosctl images default | grep -E 'kubelet|installer|pause')
EXTRA_IMAGES=(
"docker.io/coredns/coredns:1.12.2"
"quay.io/cilium/cilium:v1.17.6"
"nvcr.io/nvidia/k8s-device-plugin:v0.17.2"
)
fiThe script then combines the default and extra images and creates the image cache using talosctl images cache-create.
See the script for more details and customization options.
Additional scripts for building and extracting images are available in the scripts/ directory. Run them as needed for your workflow.
For more details, refer to the comments in each script and template file.