Feature: Deploy OpenBao with high availability #79
@@ -7,17 +7,17 @@ Use this to rebuild the k3s cluster from new VMs. **It destroys everything store
|
||||
## Why a normal `pulumi up` isn't enough
|
||||
|
||||
- **`02-k8s-bootstrap` commands run once.** They are recorded as done in state, so after new VMs appear, `pulumi up` would report them unchanged and install nothing.
|
||||
- **`03`–`05` state describes the old cluster.** The fixed `clusterIdentifier` tells Pulumi it is still the same cluster, so it would try to update resources that no longer exist.
|
||||
- **`03`–`06` state describes the old cluster.** The fixed `clusterIdentifier` tells Pulumi it is still the same cluster, so it would try to update resources that no longer exist.
|
||||
|
||||
## Before you start
|
||||
|
||||
1. **Save your data.** Longhorn has no backup target configured, so its volumes are lost with the VMs. That includes `heimdall-config` and the Prometheus metrics. Grafana's database is external and is not affected.
|
||||
2. **Stop automatic deploys.** In Gitea's **Actions** tab, disable the `01`, `03`, `04` and `05` workflows, and don't merge anything until the last step.
|
||||
1. **Save your data.** Longhorn has no backup target configured, so its volumes are lost with the VMs. That includes `heimdall-config` and the Prometheus metrics. Grafana's database is external and is not affected. OpenBao's data is lost too, so [save a snapshot](openbao.md#save-a-snapshot) outside the cluster and keep its unseal key and admin password.
|
||||
2. **Stop automatic deploys.** In Gitea's **Actions** tab, disable the `01`, `03`, `04`, `05` and `06` workflows, and don't merge anything until the last step.
|
||||
3. **Back up all state.** Run this from the repo root:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/state-backups/rebuild
|
||||
for S in 01-proxmox-infra 02-k8s-bootstrap 03-k8s-infra 04-k8s-apps 05-monitoring; do
|
||||
for S in 01-proxmox-infra 02-k8s-bootstrap 03-k8s-infra 04-k8s-apps 05-monitoring 06-openbao; do
|
||||
pulumi stack export --stack dev --cwd "$S" --file ~/state-backups/rebuild/$S.json
|
||||
done
|
||||
```
|
||||
@@ -57,17 +57,17 @@ Use this to rebuild the k3s cluster from new VMs. **It destroys everything store
|
||||
pulumi up --stack dev --cwd 01-proxmox-infra
|
||||
```
|
||||
|
||||
## 2. Clear the state of `02`–`05`
|
||||
## 2. Clear the state of `02`–`06`
|
||||
|
||||
Only do this after the old VMs are gone. It removes Pulumi's records and doesn't touch real resources or `Pulumi.dev.yaml`. `--force` is needed because `05-monitoring` protects its namespace and Helm release, so check that the old cluster is really gone before running it.
|
||||
Only do this after the old VMs are gone. It removes Pulumi's records and doesn't touch real resources or `Pulumi.dev.yaml`. `--force` is needed because `05-monitoring` and `06-openbao` protect their namespaces and Helm releases, so check that the old cluster is really gone before running it.
|
||||
|
||||
```bash
|
||||
for S in 05-monitoring 04-k8s-apps 03-k8s-infra 02-k8s-bootstrap; do
|
||||
for S in 06-openbao 05-monitoring 04-k8s-apps 03-k8s-infra 02-k8s-bootstrap; do
|
||||
pulumi state delete --all --force --yes --stack dev --cwd "$S"
|
||||
done
|
||||
```
|
||||
|
||||
Previews of `03`–`05` fail until step 3 is done, because `02` has no `kubeconfig` output yet.
|
||||
Previews of `03`–`06` fail until step 3 is done, because `02` has no `kubeconfig` output yet.
|
||||
|
||||
## 3. Bootstrap k3s (`02-k8s-bootstrap`)
|
||||
|
||||
@@ -89,13 +89,14 @@ Secret encryption is configured with `secretbox`.
|
||||
|
||||
**Checkpoint:** all six nodes are `Ready`. Then replace your normal kubeconfig with this file, because the old one no longer works.
|
||||
|
||||
## 4. Deploy `03`, `04` and `05`
|
||||
## 4. Deploy `03`–`06`
|
||||
|
||||
Deploy these through Gitea, because the runners have the `helm` CLI that `03` needs. Re-enable each workflow as you reach it, and wait for each run to finish.
|
||||
|
||||
1. Run the **Deploy k8s Infra** workflow manually.
|
||||
2. Run the **Deploy k8s Apps** workflow manually.
|
||||
3. Run the **Deploy Monitoring** workflow manually.
|
||||
4. Run the **Deploy Openbao** workflow manually, then [restore the OpenBao snapshot](openbao.md#restore-into-a-new-openbao).
|
||||
|
||||
## 5. Verify
|
||||
|
||||
@@ -109,4 +110,4 @@ kubectl get certificates -A
|
||||
|
||||
**Checkpoint:** nodes are `Ready`, no pods are unhealthy, PVCs are `Bound`, and certificates become `Ready`. New certificates come from Let's Encrypt, which rate-limits repeated requests for the same hostnames, so avoid repeated rebuilds in a short period.
|
||||
|
||||
Run `pulumi preview --stack dev --cwd <stack>` for all five stacks. None should show changes. Re-enable the `01` workflow, restore any data you saved, and delete `~/k3s-rebuilt.yaml` and `~/state-backups/rebuild`.
|
||||
Run `pulumi preview --stack dev --cwd <stack>` for all six stacks. None should show changes. Re-enable the `01` workflow, restore any data you saved, and delete `~/k3s-rebuilt.yaml` and `~/state-backups/rebuild`.
|
||||
Reference in new issue
Block a user