Repository navigation
Description
🤖 Generated by the Daily AI Assistant
Goal
Eliminate the privileged Velero node-agent DaemonSet (runs runAsUser: 0 + hostPath /var/lib/kubelet/{pods,plugins}), which is the source of Kubescape C-0057 (privileged), C-0048 (hostPath), C-0045 (writable hostPath), currently suppressed by the velero entry in k8s/bases/infrastructure/security-exceptions/infrastructure-privileged.yaml. Removing node-agent lets us delete that exception entirely.
Why this is NOT a simple toggle (investigation findings)
CSI snapshots are already enabled and live (features: EnableCSI, Longhorn VolumeSnapshotClass longhorn-snapshot-vsc labeled velero.io/csi-volumesnapshot-class: "true", snapshot-controller running). But node-agent has two essential roles that block its removal:
- Kopia data-mover — the daily schedule uses
snapshotMoveData: true, so CSI snapshots are uploaded off-site to R2 by node-agent's Kopia data-mover (live: 119DataUploads). Drop node-agent → snapshots stay in-cluster only → no DR copy. - FSB fallback for OpenBao — OpenBao runs on hcloud block storage (
csi.hetzner.cloud, no snapshot capability); the volume-policy +defaultVolumesToFsBackup: trueroute it to Kopia filesystem backup, which requires node-agent (live: 138PodVolumeBackups).
So the privilege node-agent needs is inherent to filesystem-level data movement. The real fix moves that data movement into Longhorn (already privileged + exception-covered) — a net reduction in privileged components, achieved via re-architecture.
Proposed migration
- Configure Longhorn
backupTarget→ R2. Set Longhorn'sbackup-target(S3 to the same R2 bucket/prefix or a sibling) +backup-target-credential-secret(via external-secrets). Add a LonghornVolumeSnapshotClasswithparameters.type: bak(off-site backup) alongside the existingtype: snap. - Switch Longhorn volumes from data-mover to Longhorn backup. Point the velero volume-policy / VolumeSnapshotClass at
type: bakso the snapshot is exported to R2 by Longhorn, and setsnapshotMoveData: false(no Kopia data-mover). - Re-home OpenBao's backup. Either move OpenBao's PVC to a snapshot-capable StorageClass (Longhorn), or confirm the existing OpenBao raft-snapshot CronJob is the sufficient backup of record and drop OpenBao's PVC from Velero FSB. (Decision needed — raft snapshot is logical, PVC backup is physical; pick one.)
- Remove node-agent.
deployNodeAgent: false; dropdefaultVolumesToFsBackup: true; remove the node-agent configmap/extraArgs. - Delete the exception. Remove the
veleroentry (C-0057/0048/0045) frominfrastructure-privileged.yaml.
Restore validation loop (MUST pass before promotion)
Data protection is silent-failure-prone, so each step is gated on a real restore:
- Create a throwaway namespace + Longhorn PVC + pod writing a known sentinel value.
velero backup create(CSI snapshot → Longhorntype: bak→ R2). Confirm the backup isCompletedand the snapshot landed in R2 (not just in-cluster).- Delete the namespace (PVC + data gone).
velero restore createfrom the backup.- Verify the PVC is recreated and the sentinel value is intact.
- Repeat for the OpenBao volume under whatever path step 3 chooses.
- Only after a clean restore of both a Longhorn volume and the OpenBao path: disable node-agent and promote.
Risks / rollback
- Silent DR loss if step 1–2 don't actually move snapshots off-site — the restore test gates this.
- Longhorn
backupTargetcredentials/endpoint must be correct (reuse the R2 external-secret pattern). - Rollback: re-enable
deployNodeAgent+snapshotMoveData: true+defaultVolumesToFsBackup: true(revert this change) restores the current working (if privileged) path.
Acceptance criteria
- Longhorn
backupTarget→R2 configured + a restore test of a Longhorn volume passes. - OpenBao backup re-homed + its restore/recovery path validated.
-
node-agentDaemonSet gone; nightly scheduleCompletedfor ≥2 nights. -
veleroentry removed frominfrastructure-privileged.yaml; C-0057/0048/0045 no longer need the exception.
Out of scope / separate
The current nightly-backup failures (06-25/26/27 Failed, velero server restarting mid-backup) are a separate live issue — see the diagnosis: node-agent crashloop (06-20→06-23, fixed by the v0.3.142 pin) + VPA InPlaceOrRecreate on a spiky backup tool. Fix/verify that before starting this migration so the validation loop runs against a healthy baseline.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fields✅ Done
Activity
devantler commentedon Jun 27, 2026
Closing — the velero node-agent stays. It provides genuine defense-in-depth for data protection: the off-site Kopia data-mover (
snapshotMoveData→ R2) and the filesystem-backup fallback for non-CSI volumes (OpenBao on hcloud block storage) — i.e. multi-method backup resilience. Removing it to satisfy C-0057/C-0048/C-0045 would trade real backup resilience for a scanner checklist.Those findings are genuinely irreducible — a filesystem-level backup data-mover must run as root with hostPath to read pod volumes — so they are correctly handled by the existing
veleroentry ininfrastructure-privileged.yaml. That exception now actually functions thanks to the mechanism repair (#2298). This is the right answer for an irreducibly-privileged component that earns its privilege, not a fix to chase.