Compare commits

...
Author SHA1 Message Date
kasun e416e6a555 docs: add RustFS backup cleanup and policy checks to runbooks
Secret Scan / Betterleaks (pull_request) Successful in 7s
Object lock only blocks deletion; it never removes old backups, and the
RustFS console has no lifecycle screen, so the rule is set with the AWS
CLI. Also note that a new policy must be attached to the user, which
caused the first backup job's AccessDenied.
2026-12-03 03:34:53 +01:00
kasun 063688746e Merge pull request 'Feature: Back up OpenBao to RustFS every hour' (#80) from feature/automate-openbao-backups into main
Deploy Openbao / Pulumi Preview (push) Skipped
Deploy Openbao / Pulumi Deploy (push) Successful in 43s
Secret Scan / Betterleaks (push) Successful in 5s
Reviewed-on: #80
2026-12-02 14:55:48 +01:00
kasun 86af2c6fcb docs: remove trailing space in CLAUDE.md
Deploy Openbao / Pulumi Deploy (pull_request) Skipped
Deploy Openbao / Pulumi Preview (pull_request) Successful in 1m29s
Secret Scan / Betterleaks (pull_request) Successful in 10s
2026-12-02 04:39:29 +01:00
claude-bot Bot 2091607f0d Merge pull request 'Feature: Deploy OpenBao with high availability' (#79) from feature/deploy-openbao-ha into main
Deploy Openbao / Pulumi Preview (push) Skipped
Deploy Openbao / Pulumi Deploy (push) Successful in 41s
Secret Scan / Betterleaks (push) Successful in 5s
2026-12-01 04:48:17 +01:00
kasun d815334b04 Merge pull request 'Chore: Clarify Traefik and Kubernetes API addresses' (#78) from chore/clarify-vip-comments into main
Deploy k8s Infra / Pulumi Preview (push) Skipped
Deploy k8s Infra / Pulumi Deploy (push) Successful in 46s
Secret Scan / Betterleaks (push) Successful in 8s
Reviewed-on: #78
2026-12-01 04:29:42 +01:00
kasun 4ae597cfc4 chore: clarify Traefik and Kubernetes API addresses
Deploy k8s Bootstrap / Bootstrap k3s Cluster (pull_request) Skipped
Deploy k8s Infra / Pulumi Deploy (pull_request) Skipped
Deploy k8s Bootstrap / Pulumi Preview (pull_request) Successful in 35s
Deploy k8s Infra / Pulumi Preview (pull_request) Successful in 41s
Secret Scan / Betterleaks (pull_request) Successful in 6s
2026-12-01 04:25:14 +01:00
5 changed files with 36 additions and 8 deletions

No files matched your search

+4 -5
View File
@@ -74,11 +74,10 @@ function k3sInstallScript(
return pulumi.interpolate`set -euo pipefail; IFS= read -r K3S_TOKEN || true; export K3S_TOKEN; curl -sfL ${k3sInstallerUrl} | sudo --preserve-env=K3S_TOKEN INSTALL_K3S_VERSION='${k3sVersion}' ${installEnv} sh -s - ${installArgs}`;
}
// Control-plane VIP — floating IP for API server access, ARP-announced by
// kube-vip on whichever master is alive. Added as a TLS SAN on master-1's
// cert below, then used (instead of master1Ip) for every other node's join
// URL and for the exported kubeconfig, so the cluster stays reachable
// through the loss of any single master.
// Kubernetes API address (port 6443), used by kubectl, Pulumi and joining nodes.
// pfSense holds this IP, and HAProxy forwards connections to the masters, so
// the API doesn't depend on a single master.
// This isn't kubeVipAddress in 03-k8s-infra, which is Traefik's IP for web apps.
const controlPlaneVipAddress = config.requireSecret("controlPlaneVipAddress");
// VM IDs and CI runner SSH key — read from proxmox-infra stack outputs
+5
View File
@@ -16,6 +16,10 @@ const truenasNfsPath = config.requireSecret("truenasNfsPath");
const cloudflareToken = config.requireSecret("cloudflareApiToken");
const letsencryptEmail = config.requireSecret("letsencryptEmail");
// Traefik's IP for web apps (ports 80 and 443). kube-vip announces it on the
// LAN, and the app domains in pfSense's DNS Resolver must point to it.
// This isn't the Kubernetes API address. That's controlPlaneVipAddress in
// 02-k8s-bootstrap, which is provided by pfSense and HAProxy.
const kubeVipAddress = config.requireSecret("kubeVipAddress");
const kubeVipInterface = config.require("kubeVipInterface");
@@ -547,6 +551,7 @@ const kubeVipCloudProvider = new k8s.apps.v1.Deployment(
opts({ dependsOn: [cloudProviderClusterRoleBinding, kubeVipPool] }),
);
// Assigns kubeVipAddress to the Traefik Service that k3s creates.
new k8s.core.v1.ServicePatch(
"traefik-vip",
{
+1 -1
View File
@@ -36,7 +36,7 @@ Branch names, commit messages and PR titles follow @CONVENTIONS.md. The commit-m
Only commit when I explicitly say "commit" for that change. A yes to a question that also mentioned committing is not enough; when unsure, ask.
The remote is a self-hosted Gitea, so `gh` doesn't work. For PRs and their CI status use `.claude/scripts/gitea.sh` (acts as `claude-bot`), e.g. `.claude/scripts/gitea.sh GET '/repos/kasun/homelab-infrastructure-as-code/pulls?state=open'`.
The remote is a self-hosted Gitea, so `gh` doesn't work. For PRs and their CI status use `.claude/scripts/gitea.sh` (acts as `claude-bot`), e.g. `.claude/scripts/gitea.sh GET '/repos/kasun/homelab-infrastructure-as-code/pulls?state=open'`.
## Live infrastructure
+1 -1
View File
@@ -148,7 +148,7 @@ Only do this once steps 5 and 6 have worked. Check that Bitwarden has the admin
## Automatic backups
A CronJob from the OpenBao Helm chart saves a Raft snapshot every hour and uploads it to the `openbao-backups` bucket in RustFS on TrueNAS. Object lock keeps each backup for 30 days. The job logs in with Kubernetes auth and can only read snapshots. Its RustFS key can only upload.
A CronJob from the OpenBao Helm chart saves a Raft snapshot every hour and uploads it to the `openbao-backups` bucket in RustFS on TrueNAS. Object lock keeps each backup for 30 days, and a lifecycle rule deletes it after about 32 days. The job logs in with Kubernetes auth and can only read snapshots. Its RustFS key can only upload.
> Missed or failed backups don't trigger alerts yet. Check the job now and then, and still [save a snapshot](#save-a-snapshot) before upgrades.
+25 -1
View File
@@ -262,7 +262,31 @@ Object lock can only be turned on when a bucket is created. OpenBao's backup job
6. Protect the RustFS data with ZFS snapshots. Go to **Data Protection > Periodic Snapshot Tasks** and check that a task covers `<pool>/rustfs`, either directly or through a recursive task on its parent. Keep snapshots for at least 30 days. They protect backups if someone misuses the RustFS admin login. They don't protect against losing the pool.
Old backups aren't cleaned up automatically yet. The bucket keeps growing until a cleanup rule has been tested and added.
7. Delete old backups automatically. The lock from step 2 only stops deletion for 30 days; it doesn't delete anything. Old snapshots also contain old secrets, so don't keep them forever. The RustFS console has no lifecycle screen, so set the rule with the AWS CLI:
```bash
cat > lifecycle.json <<'EOF'
{"Rules":[
{"ID":"expire-after-31-days","Status":"Enabled","Filter":{"Prefix":""},
"Expiration":{"Days":31},
"NoncurrentVersionExpiration":{"NoncurrentDays":1}},
{"ID":"remove-delete-markers","Status":"Enabled","Filter":{"Prefix":""},
"Expiration":{"ExpiredObjectDeleteMarker":true}}
]}
EOF
admin s3api put-bucket-lifecycle-configuration --bucket openbao-backups --lifecycle-configuration file://lifecycle.json
admin s3api get-bucket-lifecycle-configuration --bucket openbao-backups
```
**Checkpoint:** both rules show `"Status": "Enabled"`.
The bucket is versioned, so the rule needs three parts. After 31 days, when the lock has ended, a backup gets a delete marker. One day later, its data is deleted. Then the leftover delete marker is removed. Each backup is kept for about 32 days. Lifecycle rules respect the lock, so a backup can't be deleted early even if the rule is wrong.
About 32 days after the first backup, check that cleanup works. The oldest date shown should be at most about 32 days ago:
```bash
admin s3api list-object-versions --bucket openbao-backups --query 'Versions[].LastModified' --output text | tr '\t' '\n' | sort | head -3
```
## Troubleshooting