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.
39 lines
2.8 KiB
Markdown
39 lines
2.8 KiB
Markdown
# 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 `controlPlaneVipAddress` except master-1's own install.** master-1 is installed with `--cluster-init` and a `--tls-san` for both `master1Ip` and the VIP. The stack then waits for `https://<controlPlaneVipAddress>:6443/healthz` before anyone joins, because master-2, master-3 and the workers all join via the VIP, and the exported `kubeconfig` points 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-vip `cp_enable` for API access: it was considered and rejected, see [the decision record](../docs/decisions/0001-control-plane-vip-via-pfsense-haproxy.md). The manual pfSense steps are in [the runbook](../docs/runbooks/pfsense-control-plane-vip.md).
|
|
- **Workers get a dedicated Longhorn disk.** The `scsi1` disk is formatted ext4 (if not already) and mounted at `/mnt/longhorn-extra` via `/etc/fstab`. `03-k8s-infra` later registers it as an extra Longhorn disk, which keeps Longhorn off the root filesystem and avoids `DiskPressure`.
|
|
|
|
## Required Pulumi config
|
|
|
|
```bash
|
|
# 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.
|