Granting access to an IAM principal to view Kubernetes resources on a cluster
Grant IAM principals access to the Amazon EKS console to view information about Kubernetes resources running on your connected cluster.
Prerequisites
The IAM principal that you use to access the Amazon Web Services Management Console must meet the following requirements:
-
It must have the
eks:AccessKubernetesApi
IAM permission. -
The Amazon EKS Connector service account can impersonate the IAM principal in the cluster. This allows the Amazon EKS Connector to map the IAM principal to a Kubernetes user.
To create and apply the Amazon EKS Connector cluster role
-
Download the
eks-connector
cluster role template.curl -O https://s3.cn-north-1.amazonaws.com.cn/amazon-eks/eks-connector/manifests/eks-connector-console-roles/eks-connector-clusterrole.yaml
-
Edit the cluster role template YAML file. Replace references of
%IAM_ARN%
with the Amazon Resource Name (ARN) of your IAM principal. -
Apply the Amazon EKS Connector cluster role YAML to your Kubernetes cluster.
kubectl apply -f eks-connector-clusterrole.yaml
For an IAM principal to view Kubernetes resources in Amazon EKS console, the principal
must be associated with a Kubernetes role
or clusterrole
with necessary
permissions to read the resources. For more information, see Using RBAC
Authorization
To configure an IAM principal to access the connected cluster
-
You can download either of these example manifest files to create a
clusterrole
andclusterrolebinding
or arole
androlebinding
, respectively:- View Kubernetes resources in all namespaces
-
The
eks-connector-console-dashboard-full-access-clusterrole
cluster role gives access to all namespaces and resources that can be visualized in the console. You can change the name of therole
,clusterrole
and their corresponding binding before applying it to your cluster. Use the following command to download a sample file.curl -O https://s3.cn-north-1.amazonaws.com.cn/amazon-eks/eks-connector/manifests/eks-connector-console-roles/eks-connector-console-dashboard-full-access-group.yaml
- View Kubernetes resources in a specific namespace
-
The namespace in this file is
default
, so if you want to specify a different namespace, edit the file before applying it to your cluster.Use the following command to download a sample file.curl -O https://s3.cn-north-1.amazonaws.com.cn/amazon-eks/eks-connector/manifests/eks-connector-console-roles/eks-connector-console-dashboard-restricted-access-group.yaml
-
Edit the full access or restricted access YAML file to replace references of
%IAM_ARN%
with the Amazon Resource Name (ARN) of your IAM principal. -
Apply the full access or restricted access YAML files to your Kubernetes cluster. Replace the YAML file value with your own.
kubectl apply -f
eks-connector-console-dashboard-full-access-group.yaml
To view Kubernetes resources in your connected cluster, see View Kubernetes resources. Data for some resource types on the Resources tab isn't available for connected clusters.