Feature: Deploy OpenBao as an HA secrets manager on k3s #65
Notifications
Due Date
No due date set.
Depends on
#76 Enhancement: Encrypt Kubernetes Secrets at rest in k3s
kasun/homelab-infrastructure-as-code
Reference: kasun/homelab-infrastructure-as-code#65
Reference in new issue
Block a user
Goal
Run OpenBao on k3s as the central secrets manager for machine secrets: Docker stacks deployed by
homelab-ansiblefirst, k3s workloads later. Human passwords stay in Bitwarden.OpenBao is chosen over HashiCorp Vault because it is open source (MPL-2.0) and API-compatible with Vault.
Out of scope (follow-up issues)
homelab-ansiblefrom ansible-vault to OpenBao lookupsDecisions before coding
03-k8s-infranext to cert-manager and Longhorn, or give it its own stack.03deploys on merge tomain, sopulumi upmust only create resources. Init and unseal stay manual (see below).init, because changing it later needs a seal migration.bao.<domain>through Traefik with theletsencrypt-prodClusterIssuer, like the Longhorn UI.Implementation (Pulumi)
Placement
openbao.k3s-worker-1..3run on different hosts, then use required pod anti-affinity onkubernetes.io/hostname. Optionally, letk8s-bootstrapaddtopology.kubernetes.io/zone=<pve-host>labels and spread on those.maxUnavailable: 1(the chart has one).Helm release
openbao/openbao(k8s.helm.v3.Release, same pattern as the existing releases)server.ha.enabled: true,server.ha.replicas: 3server.ha.raft.enabled: true, withretry_joinentries for all 3 podsdataStorageon k3s's built-inlocal-pathStorageClass, small (e.g. 2Gi). Raft replicates between the pods, so each pod keeps a full copy on its own node's disk. No Longhorn (that would replicate twice: 9 copies) and notruenas-nfs(Raft needs low-latency local disk).auditStoragevolume.local-pathlives on the root disk, which must stay clear ofDiskPressure.Certificate(internal issuer) mounted into the podsletsencrypt-prod05-monitoringNetwork
8200from Traefik and from namespaces that need it. Allow Raft8201only between OpenBao pods.Pulumi config and secrets
config.requireSecret()(e.g. hostname parts if they are not taken fromdomain).mainin the private config repo before opening or updating a PR that needs it.Manual steps on the live cluster (once, never in CI)
bao operator initonopenbao-0. Store the unseal/recovery keys and the initial root token in Bitwarden as separate items.openbao-0, thenopenbao-1andopenbao-2(they join throughretry_join).bao operator raft list-peersshows 3 voters andbao statusshows HA mode with 1 active node.Initial configuration (as code later, e.g. a script or a separate Pulumi stack with the Vault/OpenBao provider)
secret/. Layout:secret/stacks/<service>/...for Docker stacks,secret/k8s/<namespace>/...for later.ansible-stacks: read-only onsecret/data/stacks/*.ansible-runnerwith that policy and a short token TTL. Store its role_id/secret_id in/etc/homelab-ansible/on theansibleLXC.Backups
Raft replication isn't a backup: a deleted or corrupted secret is replicated too. Open-source OpenBao has no built-in snapshot scheduler (that's a Vault Enterprise feature), so the standard is a scheduled job calling the snapshot API. Snapshots of the PVCs (e.g. Velero) aren't used, because the snapshot API is what gives a consistent copy.
bao operator raft snapshot save. It is part of the Pulumi code, not set up by hand.readonsys/storage/raft/snapshot. No long-lived token.Monitoring (
05-monitoring)Docs
docs/runbooks/openbao.md: init, unseal after a reboot, replace a dead Raft peer (bao operator raft remove-peer, delete the pod's PVC so it rejoins empty and copies the data from the others), restore a snapshot, rotate the AppRole secret_id, break-glass access.CLAUDE.md(whylocal-pathand not Longhorn, why init is manual).Acceptance criteria
ansibleLXC can read a test secret undersecret/stacks/with the AppRole, and nothing else.npm run typecheckandpulumi previewpass for the changed stack.Kubernetes Secrets are now encrypted in etcd on the live cluster with
secretbox(#76, done on 2026-12-01). A new test Secret and an existing Secret were checked directly in etcd, and both were encrypted. Secret encryption no longer blocks OpenBao.02-k8s-bootstrapchange for fresh installs is tracked in #76.openbaonamespace.