prerequisites

Image builder:

https://image-builder.sigs.k8s.io/capi/providers/proxmox

HashiCorp officially maintains and signs packages for the following Linux distributions.

curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install packer
sudo apt install pip -y
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --user
python3 -m pip install --user ansible
curl -L https://github.com/kubernetes-sigs/image-builder/tarball/main -o image-builder.tgz
mkdir image-builder
tar xzf image-builder.tgz --strip-components 1 -C image-builder
rm image-builder.tgz
cd image-builder/images/capi
export PATH=$PWD/.bin:$PATH
vi template.pkr.hcl

add:

packer {
  required_plugins {
    goss = {
      version = "~> 3"
      source  = "github.com/YaleUniversity/goss"
    }
  }
}
vi ~/.bashrc

add at the end of the file

export PATH="$HOME/.local/bin:$PATH"
source ~/.bashrc
sudo apt install unzip -y
sudo apt-get install jq
export PACKER_FLAGS="--var 'kubernetes_rpm_version=1.31.0' \
--var 'kubernetes_semver=v1.31.0' \
--var 'kubernetes_series=v1.31' \
--var 'kubernetes_deb_version=1.31.0-1.1'"

Create proxmox user

pveum user add capmox@pve
pveum aclmod / -user capmox@pve -role PVEVMAdmin
pveum user token add capmox@pve capi -privsep 0

pveum aclmod / -user capmox@pve -role Administrator
export PROXMOX_URL="https://pve.example.com:8006/api2/json"
export PROXMOX_USERNAME=
export PROXMOX_TOKEN=
export PROXMOX_NODE="pve"
export PROXMOX_ISO_POOL="local"
export PROXMOX_BRIDGE="vmbr0"
export PROXMOX_STORAGE_POOL="local-lvm"