talltechdude.proxmox_k3os
Proxmox K3os Cluster Builder
This tool helps you set up a K3os cluster on Proxmox.
Requirements
You need to have:
- An existing Proxmox cluster with proper storage and network setup.
- The K3os ISO file saved in the ISO folder.
Role Variables
Check the defaults/main.yml
file for these settings:
# Name of the ISO file
k3os_iso: "k3os-amd64"
# Token for K3s used across all nodes - change this to something safer!
k3os_token: "SuperSecretToken"
# Storage location for templates (iso/snippets)
templates: "local"
# Path to the ISO (change if needed)
pve_iso_path: "{{ (templates == 'local') | ternary('/var/lib/vz/template/iso', '/mnt/pve/{{ templates }}/template/iso') }}"
# Path for snippets (change if required)
pve_snippets_path: "{{ (templates == 'local') | ternary('/var/lib/vz/snippets', '/mnt/pve/{{ templates }}/snippets') }}"
# Storage for disks
storage: "local"
# Size of local disk (in GB)
disk_size: 10
# Number of CPU Sockets
sockets: 1
# Memory per node (in MB)
memory: 1024
# Network bridge to use
bridge: vmbr0
# VLAN for network
vlan: 1
# Name for the cluster
cluster_name: k3os
# Where to save the KubeConfig file
kubeconfig_file: "{{ cluster_name | default ('') }}.kubeconfig.yaml"
# Include KubeConfig with konfig
konfig: true
# Assign static IPs to each node (links IP to ansible_host from inventory)
static_ip: false
Dependencies
None
Examples
Hosts file
[proxmox]
pve-01 ansible_host=10.0.0.31
pve-02 ansible_host=10.0.0.32
pve-03 ansible_host=10.0.0.33
[k3os_managers]
k3os-manager-01 ansible_host=10.0.0.11 pve_host=pve-01 vmid=701
k3os-manager-02 ansible_host=10.0.0.12 pve_host=pve-02 vmid=702
k3os-manager-03 ansible_host=10.0.0.13 pve_host=pve-03 vmid=703
[k3os_workers]
# Automatically number worker nodes - use e.g., 01:06 for 01, 02, 03, 04, 05, 06
k3os-[01:06] node_number="{{ inventory_hostname | regex_replace(\"^k3os-(\\d+)$\", \"\\1\") | int }}" ansible_host="10.0.0.{{ 20 + node_number | int }}" pve_host="{{ groups.proxmox[(node_number | int - 1) % (groups.proxmox | length)] }}" vmid="{{ node_number | int + 750 }}"
[k3os:children]
k3os_managers
k3os_workers
Playbook
- name: 'K3os | Install'
hosts: k3os
gather_facts: false
roles:
- name: talltechdude.proxmox_k3os
vars:
iso_name: "k3os-amd64-{{ k3os_version }}"
cluster_name: "Example"
License
MIT License
Author Information
TallTechDude