Connect an AWS EKS cluster#
Lens Desktop supports access to multiple Amazon Elastic Kubernetes Service (Amazon EKS) clusters using the single sign-on mechanism.
Prerequisites#
To add an AWS EKS cluster to Lens Desktop, you need to install and configure AWS CLI. See Get started with AWS CLI and Configuration and credential file settings for details.
Detect an AWS EKS cluster#
To detect your clusters automatically, you need to have the AWS CLI tool configured to the AWS profile(s) corresponding to your cluster(s). In this scenario, Lens Desktop displays available AWS EKS clusters in Kubernetes Clusters >AWS EKS. However, this way requires you to stay logged in AWS, as Lens Desktop relies on the active AWS session to access the profiles configured in AWS CLI. It enables fetching the available clusters from those AWS profiles. If you are logged out of AWS CLI, Lens Desktop displays the lock icon next to each profile signalling that authentication is required. Click the icon to log into the AWS system from Lens Desktop, or log in from AWS CLI.
Add an AWS EKS cluster kubeconfig
#
To update your local kubeconfig
, use the aws eks update-kubeconfig
AWS CLI utility. The config file gets the AWS EKS cluster configurations, which enables Lens Desktop to discover the cluster similarly to kubectl
. You can access your cluster at Kubernetes Clusters > Local Kubeconfigs.
To add an AWS EKS cluster:
-
Required only at the initial session. Configure the AWS SSO session:
If the parameters are specified correctly, an SSO authentication page opens to confirm that the request has been approved. After returning to the CLI tool, if you have multiple AWS accounts, select the one that corresponds to the target cluster.aws configure sso SSO session name (Recommended): <sso-name> SSO start URL [None]: https://<sso-portal>.awsapps.com/start SSO region [None]: <region-name>
-
Start the AWS SSO session:
An SSO authentication page opens to confirm that the request has been approved. After returning to the CLI tool, if you have several AWS accounts, select the one that corresponds to the target cluster.aws sso login
-
Update your local
kubeconfig
:Info
As the AWS account region and the cluster region may differ, specify the region that corresponds to the cluster.
aws eks --region <region-name> update-kubeconfig --name <cluster-name>
-
Check if
kubeconfig
has been updated:kubectl config get-contexts
System response example:
CURRENT NAME CLUSTER AUTHINFO NAMESPACE aks-lens-cluster aks-lens-cluster clusterUser_aks-lens-resource-group_aks-lens-cluster * arn:aws:eks:eu-north-1:841310725496:cluster/exciting-classical-ant arn:aws:eks:eu-north-1:841310725496:cluster/exciting-classical-ant arn:aws:eks:eu-north-1:841310725496:cluster/exciting-classical-ant docker-desktop docker-desktop docker-desktop
-
Open Lens Desktop and check if the new cluster appears in Navigator > Local Kubeconfigs section.