Skip to content

Add User to K8s Cluster

How to give user super admin rights to existing k8s cluster on aws.

Check-user-id-and-arn

Bash
aws sts get-caller-identity
Bash Session
{
    "UserId": "XXXXXXXXXXXXXXXXXXXXX",
    "Account": "XXXXXXXXXXXX",
    "Arn": "arn:aws:iam::XXXXXXXXXXXX:user/designated_user"
}

Give-user-admin-rights

Bash
eksctl create iamidentitymapping --cluster=clustername --arn "arn:aws:iam::xxxxxxxxxxxx:user/username" --group=system:masters --username username
Bash
eksctl delete iamidentitymapping --cluster=clustername --arn "arn:aws:iam:::xxxxxxxxxxxx:user/username"

Client has to do:

Bash
aws eks update-kubeconfig --region <region> --name <cluster-name> --profile <profile-name-default-if-none>

Check Here - www.eksworkshop.com

Back to top