Interview Prep/GitHub Actions/OIDC & Cloud Authentication

kubectl now authenticates but returns `Error from server (Forbidden): deployments.apps "shack-api" is forbidden: User "arn:aws:sts::111122223333:assumed-role/gha-deploy-prod/gha-987" cannot patch resource "deployments" in API group "apps" in the namespace "shack-staging"`

IntermediateTroubleshootingOIDC & Cloud Authentication
Answer

Likely causes → The access policy is scoped to a different namespace, or the workflow targets the wrong namespace for the environment.

Diagnose →

aws eks list-associated-access-policies --cluster-name shack --principal-arn arn:aws:iam::111122223333:role/gha-deploy-prod
kubectl auth can-i patch deployments -n shack-staging

Fix → Correct the namespace in the workflow, or the scope in the access policy.

Prevent → Derive namespace from the environment name (shack-${{ inputs.environment }}) so they cannot diverge.

All GitHub Actions questions Roadmap: GitHub Actions

More on OIDC & Cloud Authentication