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.
More on OIDC & Cloud Authentication
`Error: Could not assume role with OIDC: Not authorized to perform sts:AssumeRoleWithWebIdentity`Advanced`Error: Credentials could not be loaded, please check your action inputs: Could not load credentials from any providers`Intermediate`Error: Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable`BeginnerOIDC works on `main` but fails on a tag-triggered release workflow.Intermediate`An error occurred (AccessDenied) when calling the AssumeRoleWithWebIdentity operation: Incorrect token audience`Intermediate`No OpenIDConnect provider found in your account for https://token.actions.githubusercontent.com`Beginner