The pfSense and TrueNAS procedures are for people, so they no longer load as Claude context. The stack CLAUDE.md files keep only what the code cannot show.
2.8 KiB
k8s-bootstrap
Bootstraps a k3s cluster on the Proxmox VMs created by proxmox-infra. Starts VMs via the Proxmox REST API, then provisions k3s over SSH using @pulumi/command remote.Command. Exports the secret stack output kubeconfig.
Decisions the code doesn't explain
- Everything goes through
controlPlaneVipAddressexcept master-1's own install. master-1 is installed with--cluster-initand a--tls-sanfor bothmaster1Ipand the VIP. The stack then waits forhttps://<controlPlaneVipAddress>:6443/healthzbefore anyone joins, because master-2, master-3 and the workers all join via the VIP, and the exportedkubeconfigpoints at it. - The VIP is pfSense + HAProxy, set up by hand, not kube-vip.
03-k8s-infra's kube-vip DaemonSet only handles Service/LoadBalancer VIPs. Don't propose kube-vipcp_enablefor API access: it was considered and rejected, see the decision record. The manual pfSense steps are in the runbook. - Workers get a dedicated Longhorn disk. The
scsi1disk is formatted ext4 (if not already) and mounted at/mnt/longhorn-extravia/etc/fstab.03-k8s-infralater registers it as an extra Longhorn disk, which keeps Longhorn off the root filesystem and avoidsDiskPressure.
Required Pulumi config
# Pre-shared k3s token — any strong random string
pulumi config set --secret k3sToken "$(openssl rand -hex 32)"
# Node IPs — static DHCP leases from the router (not secrets)
pulumi config set master1Ip "192.168.1.x"
pulumi config set master2Ip "192.168.1.x"
pulumi config set master3Ip "192.168.1.x"
pulumi config set worker1Ip "192.168.1.x"
pulumi config set worker2Ip "192.168.1.x"
pulumi config set worker3Ip "192.168.1.x"
# Control-plane VIP — floating IP for API server access, fronted by pfSense
# + HAProxy. Must be a free address outside the router's DHCP pool.
pulumi config set --secret controlPlaneVipAddress "192.168.1.147"
VM IDs, the CI runner SSH private key, and Proxmox credentials (pve1Endpoint, pve1ApiToken, pve2Endpoint, pve2ApiToken, pve3Endpoint, pve3ApiToken) are read automatically from proxmox-infra via StackReference — do not set them here.
Prerequisites
proxmox-infra must be deployed first. On its first pulumi up it generates an ed25519 SSH keypair via @pulumi/tls, writes the public key into every VM's cloud-init, and exports the private key as a secret stack output. VMs must be re-provisioned (or have the public key manually added to ~/.ssh/authorized_keys) before this stack can SSH in.
CI/CD
Workflow: ../.gitea/workflows/02-deploy-k8s-bootstrap.yaml. Secret: K8S_BOOTSTRAP_PULUMI_DEV_YAML. Deploy is manual (workflow_dispatch) — re-running this stack restarts the bootstrap sequence against live VMs.