This repository contains tools and configurations to create a custom Debian-based VM template for Exoscale with NVIDIA GPU support, CUDA, and Kubernetes (k3s) pre-installed.
The project uses mkosi to build a custom Debian Bookworm image with:
- NVIDIA drivers and CUDA 12.6.3
- Docker with NVIDIA container runtime
- k3s (lightweight Kubernetes)
- AI Operator for managing ML workloads
- Pre-configured NVIDIA device plugin for Kubernetes
- Exoscale CLI (
exo
) installed and configured mkosi
installed on your systemqemu-utils
for image conversion- Access to Exoscale account and API credentials
Building the Template
- Initialize the build environment:
make init
- Build the image:
make build
- Convert the raw image to qcow2
make convert
- Create a storage bucket and upload the image:
make create_bucket
make upload_permissions
make upload
- Register the template
make register
There is also the possibility to do all steps at once:
make os_template
- Create a VM using the template:
exo compute instance create \
--instance-type gpu2.small \
--template <template-id> \
--zone at-vie-1 \
--disk-size 100 \
--ssh-key <your-ssh-key> \
ai
- The VM comes pre-configured with:
- k3s Kubernetes cluster
- NVIDIA device plugin
- AI operator for managing ML workloads
- Docker with NVIDIA runtime
- k9s
mkosi.conf
: Main configuration for building the Debian imagemkosi.postinst.chroot
: Post-installation script that installs NVIDIA drivers, CUDA, Docker, and k3smanifests
: Example Kubernetes manifests for GPU workloadsDockerfile
: Base container image for GPU workloadsMakefile
: Automation for building and deploying the template
.
├── build.sh # Build script wrapper
├── convert.sh # Image conversion script
├── Dockerfile # GPU-enabled container base image
├── manifests/ # Kubernetes manifests
├── mkosi.conf # Main mkosi configuration
├── mkosi.extra/ # Additional files for the image
└── mkosi.postinst.chroot # Post-installation configuration
To modify the image:
- Edit mkosi.conf for base system configuration
- Modify mkosi.postinst.chroot for software installation
- Update mkosi.extra for additional files
- Re-build the image via:
make os_template
- Verify NVIDIA drivers:
nvidia-smi
- Check container runtime:
docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi
- Verify k3s status:
systemctl status k3s
We welcome contributions from the community. Please follow these guidelines when contributing to the project:
- Fork the repository and create a new branch for your feature or bugfix.
- Write clear and concise commit messages.
- Ensure your code follows the project's coding standards.
- Submit a pull request with a detailed description of your changes.
This project is licensed under the MIT License. See the LICENSE file for more information.