Engineering problem

Kubernetes Security Checklist: RBAC and Workloads

Plan and verify a Kubernetes hardening baseline covering Pod Security admission, service account grants, namespace traffic and ownership of add-on upgrades.

Editorial update

Decision in brief

Start with a measured namespace baseline and one workload. Define the policies for pod admission, service account access and permitted network flows, then test each control independently. For separate tenants with different administrators or trust requirements, review whether dedicated clusters are needed before relying on shared namespaces.

Test each control: Pod admission. Account access. Network flows.
Start with one namespace and workload. Review tenant trust boundaries before relying on shared namespaces.

Pick controls and explicit exceptions

Use Pod Security admission namespace labels to observe and then enforce the target policy. Check workloads and supported cluster versions before raising the policy level. Scope RBAC roles to the required resources, verbs and namespaces. Disable automatic service account token mounting where a pod needs no API access. Review controllers and delivery identities separately from the application's runtime account.

Choose a network plugin with NetworkPolicy support. Inventory DNS, ingress, observability and other required flows before enabling a namespace policy. Tests need real positive and negative request paths. Admission, network policy and RBAC enforce different layers, so a passing check at one layer leaves the others open.

LayerChange to evaluateEvidence before promotion
Pod admissionApply warn and audit first, then enforce the agreed profile in the pilot namespaceApproved workloads schedule and an intentionally nonconforming test manifest is rejected before persistence.
Workload RBACGive a workload a service account with narrowly scoped grantsExpected reads work, while an unrelated namespace and disallowed writes are denied.
NetworkApply an explicit allowlist over default-deny policy where feasibleExpected service and DNS traffic works, while a synthetic unapproved connection is blocked.
Add-ons and upgradesInventory versions, support status, owners and rollback routesEvery critical add-on has an owner and a tested replacement or upgrade path.

What HN cases add to the checklist

felixnotka introduced Audicia to propose narrower roles using observed API usage in audit logs. Use observed access to seed a role review, and exercise scheduled jobs and recovery before pruning grants. Short observation windows can miss infrequent legitimate paths.

In a separate thread about the Kubernetes committees' ingress-nginx statement, hahn-kev described confusion between similarly named controllers. Inventory the exact controller, release stream and owning vendor before making an upgrade or replacement decision.

Prove the policy works in a staging namespace

Use a staging cluster you administer, a synthetic service with no production secrets and a documented list of allowed calls. Establish a successful deployment and traffic baseline before changing policies.

  1. Review warning and audit data for the planned profile. Apply enforcement to the test namespace and confirm the intended app is admitted. Submit a harmless nonconforming fixture with server-side dry run and verify denial.
  2. Using the test identity, check allowed and forbidden resource actions. Exercise the app's scheduled and recovery tasks as well as normal instance startup.
  3. Send harmless requests along approved and unapproved paths from controlled test services. Include DNS, health checks and monitoring. Record observed outcomes against the expected matrix.
  4. Roll the policy back in staging, then apply it again. Promote only when all expected allows and denials match, service health stays within its error budget, and the rollout owner can remove or revise the policy within the agreed recovery window.

Related articles