Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS EKS: How is the first user added to system:masters group by EKS

EKS documentation says

"When you create an Amazon EKS cluster, the IAM entity (user or role) is automatically granted system:master permissions in the cluster's RBAC configuration".

But after the EKS cluster creation, if you check the aws-auth config map, it does NOT have the ARN mapping to system:masters group. But I am able to access the cluster via kubectl. So if the aws-auth (heptio config map) DOES NOT have the my ARN (I was the one who created the EKS cluster) mapped to system:masters group, how does the heptio aws authenticator authenticate me?

like image 822
Rajarajan Pudupatti Sundari Je Avatar asked Jul 02 '18 20:07

Rajarajan Pudupatti Sundari Je


People also ask

How can I give EKS cluster to another user?

To extend system:masters permissions to other users and roles, you must add the aws-auth ConfigMap to the configuration of the Amazon EKS cluster. The ConfigMap allows other IAM entities, such as users and roles, to access the Amazon EKS cluster.

Is there a master node in EKS?

EKS clusters are composed of the following main components—a control plane and worker nodes. Each cluster runs in its own, fully managed Virtual Private Cloud (VPC). The control plane is composed of three master nodes, each running in a different AZ to ensure AWS high availability.

How does EKS authentication work?

Amazon EKS uses IAM to provide authentication to your Kubernetes cluster (through the aws eks get-token command, available in version 1.16. 156 or later of the AWS CLI, or the AWS IAM Authenticator for Kubernetes ), but it still relies on native Kubernetes Role Based Access Control (RBAC) for authorization.

How do you confirm that the ARN matches the cluster creator?

Confirm that the ARN matches the cluster creator. To find the cluster creator, you can run the following command in Amazon CloudWatch Application Insights. Note: Amazon EKS maps the cluster creator IAM role on the control plane side as kubernetes-admin.


1 Answers

I got to know the answer. Basically on the heptio server side component, the static mapping for system:master is done under /etc/kubernetes/aws-iam-authenticator/ (https://github.com/kubernetes-sigs/aws-iam-authenticator#3-configure-your-api-server-to-talk-to-the-server) which is mounted into the heptio authenticator pod. Since you do not have access to this in EKS, you cant see it. However if you do invoke the /authenticate yourself with the pre-signed request, you should get the TokenReviewStatus response from heptio authenticator showing the mapping for ARN (who created the cluster) to system:master group!

like image 88
Rajarajan Pudupatti Sundari Je Avatar answered Oct 20 '22 10:10

Rajarajan Pudupatti Sundari Je