Skip to content

feat(chart): add per-workload service accounts and least-privilege RBAC#76

Open
anchapin wants to merge 1 commit into
179d_spot_instancefrom
feat/chart-security-hardening
Open

feat(chart): add per-workload service accounts and least-privilege RBAC#76
anchapin wants to merge 1 commit into
179d_spot_instancefrom
feat/chart-security-hardening

Conversation

@anchapin

Copy link
Copy Markdown
Collaborator

Summary

Replaces the legacy cluster-admin ClusterRoleBinding on the namespace default ServiceAccount with dedicated per-workload ServiceAccounts and a least-privilege Role scoped to the pre-delete hook.

Changes

New: workload-serviceaccounts.yaml

Creates dedicated ServiceAccounts for: web, web-background, worker, rserve, db, redis, nfs-cleanup (pre-delete hook).

Updated: nfs-disconnect-rbac.yaml

  • Least-privilege path (default): Creates a Role with only delete on specific Deployments, bound to nfs-cleanup-sa
  • Legacy path (opt-in): Keeps the original ClusterRoleBinding cluster-admin binding for backwards compatibility
  • Toggle: security.legacyDefaultServiceAccountClusterAdmin.enabled (default: false)

Updated: All deployment specs

Each deployment now references its dedicated ServiceAccount via spec.serviceAccountName.

Updated: aws/cluster_setup.md

Documents the two-phase SA hardening rollout (phase 1: set legacyDefaultServiceAccountClusterAdmin.enabled=true, phase 2: set false).

Values Added

db.serviceAccount.{create,name,annotations}
redis.serviceAccount.{create,name,annotations}
rserve.serviceAccount.{create,name,annotations}
web_background.serviceAccount.{create,name,annotations}
web.serviceAccount.{create,name,annotations}
worker.serviceAccount.{create,name,annotations}
pre_delete_hook.serviceAccount.{create,name,annotations}
security.legacyDefaultServiceAccountClusterAdmin.enabled

Rollout Notes

Apply with --set security.legacyDefaultServiceAccountClusterAdmin.enabled=true first, verify no workload uses default SA, then flip to false.

- Add dedicated ServiceAccount per workload (web, web-background, worker,
  rserve, db, redis, pre-delete-hook) via new workload-serviceaccounts.yaml
- Replace legacy cluster-admin ClusterRoleBinding on default SA with a
  least-privilege Role+RoleBinding scoped to the pre-delete hook
- Add security.legacyDefaultServiceAccountClusterAdmin.enabled toggle for
  phased rollout (false = least-privilege, true = legacy)
- Assign serviceAccountName to all deployment specs
- Document the phased SA hardening rollout in aws/cluster_setup.md

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants