Skip to content
RaΓΊl Tapara Y. edited this page Sep 3, 2025 · 1 revision

πŸ› οΈ Packer Proxmox

This project contains a Packer template to build custom images for Proxmox VE. It’s ideal for automating the creation of base images like Ubuntu Server with pre-installed configurations (such as kubeadm, etc.).

πŸš€ Requirements

  • Proxmox VE with API access
  • Packer β‰₯ 1.8
  • API token with permission to create VMs

πŸ“¦ Usage Steps

1️⃣ Initialize Packer (install plugins and prepare the environment)

packer init -upgrade .

βœ… Validate the template with custom variables

packer validate -var-file=dev.pkrvars.hcl .

πŸ—οΈ Build image (interactive mode on error)

packer build -on-error=ask -var-file="dev.pkrvars.hcl" .

πŸ” Build with detailed logs

PACKER_LOG=1 packer build -on-error=ask -var-file="dev.pkrvars.hcl" . 2>&1 | tee logs/packer-build-$(date +"%Y-%m-%d_%H:%M:%S").log

πŸ“ Recommended Project Structure

packer
β”œβ”€β”€ base-images
β”‚   β”œβ”€β”€ files
β”‚   β”‚   └── 99-pve.cfg               # PVE configuration file
β”‚   β”œβ”€β”€ http
β”‚   β”‚   β”œβ”€β”€ meta-data                # cloud-init metadata
β”‚   β”‚   └── user-data                # cloud-init user data
β”‚   β”œβ”€β”€ logs
β”‚   β”‚   β”œβ”€β”€ packer-build-*.log       # build logs
β”‚   β”œβ”€β”€ dev.pkrvars.hcl              # development variables
β”‚   β”‚   └── install-configure.sh     # script to install kubeadm
β”‚   β”œβ”€β”€ ubuntu-server-noble.pkr.hcl # Packer template for Ubuntu Server
β”‚   └── variables.pkr.hcl            # common variables for all templates
└── README.md

The base image is Ubuntu Server 24.04 LTS and has firewalld enabled by default.

Below is a summary of the open ports:

Port or Range Protocol Function Direction Used by
6443 TCP Kubernetes API Inbound All
2379-2380 TCP etcd services Inbound kube-apiserver, etcd
10250 TCP Kubelet API Inbound Self, control plane
10251 TCP kube-scheduler Inbound Self
10252 TCP kube-controller-manager Inbound Self