Interview Prep/Kubernetes/Security, RBAC and policy

A CI pipeline needs to deploy to one namespace. What identity do you give it?

IntermediateScenarioSecurity, RBAC and policy
Answer

Situation read → The pipeline currently uses a cluster-admin kubeconfig.

What I'd do →

  1. Create a ServiceAccount ci-deployer in the namespace
  2. Grant a Role limited to deployments, services, configmaps with verbs get, list, create, update, patch
  3. Use short-lived tokens through OIDC federation (GitHub Actions to IAM to EKS) rather than long-lived secrets
  4. Verify with kubectl auth can-i --list --as system:serviceaccount:app:ci-deployer -n app
  5. Rotate and audit

Why → Short-lived, scoped credentials limit damage when a pipeline is compromised.

Interview tip → Say never cluster-admin in CI.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Security, RBAC and policy