Go to file
Yadunand Prem 3f77453c3e
feat: potential gitea
2024-11-17 14:25:04 -05:00
apps feat: potential gitea 2024-11-17 14:25:04 -05:00
cluster/base feat: deploy authentik 2024-11-09 13:06:04 -05:00
infra feat: add ingress for longhorn 2024-11-13 00:17:01 -05:00
nixos feat: deploy staging letsencrypt 2024-11-06 21:16:35 -05:00
.gitignore feat: add flake to create iso and create VMs 2024-08-14 11:27:36 +08:00
Architecture.md feat: add external dns 2024-11-05 23:03:00 -05:00
flake.lock feat: expose everything 2024-10-17 17:33:50 -04:00
flake.nix feat: update flakes 2024-10-26 19:07:57 -04:00
Readme.md feat: organise better 2024-10-17 17:33:51 -04:00
todos.txt feat: add zerotier 2024-10-22 16:56:21 -04:00

Homelab

A quick guide on setting up new VMs / Servers in the Homelab with proxmox.

Pre-Requisites

  1. A tailscale setup, with a preauthkey with a long expiry. This will be baked into the nixos ISO for easy access to new VMs

Install Guide

  1. Generate ISO

This is to be run on the proxmox node.

nix build --refresh "git+https://gitea.ts.yadunut.com/yadunut/homelab.git#generate-iso"

Copy ISO Over to the VM

cp ./result/iso/nixos-yadunut.iso /var/lib/vz/template/iso
  1. Create virtual machines on proxmox

This command is to be run on the proxmox Node / via SSH. Follow the guide to setup the VM.

TODO: This currently only works on falcon, to support other nodes, I need to create new VMs via the API with pvesh instead of the qm tool.

nix run --refresh --verbose "git+https://gitea.ts.yadunut.com/yadunut/homelab.git?ref=main#create-vm"

Copy the IP address

Process to creating a New Machine

  1. Create an ISO and transfer it over to Proxmox if it doesn't already exist
  2. Create the VMs on Proxmox with the nix run "git+https://gitea.ts.yadunut.com/yadunut/homelab.git#create-vm" command
  3. Create the machine configuration in ./nixos/machines
  4. With NixOS anywhere,

Problem

I want to copy the tailscale key over to the newly initialized VMs. I guess the VMs don't need to have tailscale setup on launch of the ISO unless I bake it into the ISO 🤔

Wait I could bake it into the ISO.

It has been baked into the ISO. So now, I can connect to the VM from without being in the same network :)

Now that I have VMs booted into the ISO, I need to setup the VMs. This would firstly require:

  1. Generating the host keys
  2. Tailscale encrypt with age, and transfer to the VM
  3. Encrypting

Flux

flux bootstrap gitea --owner=yadunut --repository=homelab --hostname=gitea.ts.yadunut.com --path flux

Give Ups

  1. Gave up on attempting SDN with DHCP on proxmox

Notes

Why the fuck are there 2 kustomizations https://fluxcd.io/flux/faq/#are-there-two-kustomization-types

Uninstalling k3s on nix

sudo su - root KUBELET_PATH=$(mount | grep kubelet | cut -d' ' -f3); ${KUBELET_PATH:+umount $KUBELET_PATH}

rm -rf /etc/rancher/{k3s,node}; rm -rf /var/lib/{rancher/k3s,kubelet,longhorn,etcd,cni}