Skip to content

kubebn/talos-packer-custom-nvidia

Repository files navigation

Talos Packer Build Instructions

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.

Prerequisites

  • Packer installed
  • Access to required base images and credentials (if needed)

Usage

1. Build Master Nodes

To build images for master nodes, use the masters-talos-build.pkr.json.pkr.hcl template:

packer build masters-talos-build.pkr.json.pkr.hcl

2. Build Worker Nodes

To build images for worker nodes, use the workers-talos-build.pkr.json.pkr.hcl template:

packer build workers-talos-build.pkr.json.pkr.hcl

3. Build Custom NVIDIA Driver Image

If 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.hcl

Creating an Image Cache (image-cache.oci or image-cache-cp.oci)

The 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 CP variable is set to true.
    • If CP=true, it creates image-cache-cp.oci and includes all default Talos images plus:
      • 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
    • Otherwise, it creates image-cache.oci and includes only the default Talos images for kubelet, installer, and pause, plus:
      • docker.io/coredns/coredns:1.12.2
      • quay.io/cilium/cilium:v1.17.6
      • nvcr.io/nvidia/k8s-device-plugin:v0.17.2

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"
  )
fi

The 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.

Scripts

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.

About

Build custom nvidia drivers for talos

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published