Skip to content

Instantly share code, notes, and snippets.

@leadelngalame1611
Created September 8, 2022 07:01
Show Gist options
  • Save leadelngalame1611/ff3284fbd6dc62b05ca4e6f0aae26334 to your computer and use it in GitHub Desktop.
Save leadelngalame1611/ff3284fbd6dc62b05ca4e6f0aae26334 to your computer and use it in GitHub Desktop.
MOdify role in kubernetes
ROLE_ARN="arn:aws:iam::XXXXXXXXXXXX:role/developer
USERNAME="developer"
ROLE=" - rolearn: ${ROLE_ARN}\n username: ${USERNAME}\n groups:\n - system:masters"
kubectl get -n kube-system configmap/aws-auth -o yaml | awk "/mapRoles: \|/{print;print \"$ROLE\";next}1" > /tmp/aws-auth-patch.yml
kubectl patch configmap/aws-auth -n kube-system --patch "$(cat /tmp/aws-auth-patch.yml)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment