Skip to content

liorokman/packer-Debian

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

packer-kubernetes-debian

packer-kubernetes-debian is a set of configuration files used to build an automated Debian 12 virtual machine images using Packer.

This repository was forked from https://github.com/eaksel/packer-Debian11 and heavily modified:

  1. Uses Debian cloud images instead of an installation iso file
  2. Uses cloud-init instead of ansible

The image is created with everything required to use the provided VM as a Kubernetes node.

Prerequisites

How to use Packer

Commands to create an automated VM image:

To create a Debian VM image use the following command:

packer build debian.pkr.hcl

Customizing

By default the vm is based on daily cloud images from Debian. The latest daily image is configured. This can be changed in the variables section in debian.pkr.hcl.

The Kubernetes version installed for kubectl, kubeadm, and kubelet is also configurable in the variable section in debian.pkr.hcl.

Default credentials

There are no default credentials for the default debian user. Use cloud-init to provide an ssh authorized key to be able to log in.

Use in Proxmox

Create a template VM that can be cloned to create actual VMs.

  1. Create a VM without any storage
       qm create $VMID -name kubetemplate -agent enabled=1 \
                       -sockets 2 -cores 2 -cpu host -memory 4096 \
                       -net0 model=virtio,bridge=vmbr0 \
                       -scsihw virtio-scsi-single \
                       -ostype l26 -serial0 socket \
                       -rng0 source=/dev/hwrng
  2. Copy to built image ($IMAGE) to one of the Proxmox cluster nodes
  3. Import the image into Proxmox and assign it as a disk to the target VM
       qm disk import $VMID $IMAGE $STORAGE_NAME
  4. Update the VM to attach the newly imported disk to the correct hardware. Virtio works best, but SATA or SCSI are also fine.
       qm set $VMID -virtio0 $STORAGE_NAME:vm-$VMID-disk-0
  5. Add cloud-init to the vm
       qm set $VMID --ide2 $STORAGE_NAME:cloudinit
  6. Update the VM's boot order
       qm set $VMID -boot 'order=virtio0;net0'
  7. Transform the new VM into a template VM
       qm template $VMID

This template can be cloned to create a runnable VM. Use cloudinit to set the new VM's network information and an SSH key for the default debian user.

About

Packer configuration files for Debian

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HCL 70.1%
  • Shell 29.9%