Connecting to Amazon EKS and Viewing Clusters (kubectl + Lens)

This guide explains how to authenticate with AWS EKS, configure kubectl, and connect using Lens (Kubernetes IDE) or, optionally, the Kubernetes Dashboard.

Prerequisites
  • AWS CLI v2+ installed and configured with SSO or access keys.

  • kubectl installed.

  • eksctl (optional, for cluster management) → eksctl.io.

  • Lens installed → Download here.

  • IAM permissions to describe and access EKS clusters.

  • IAM permissions to list and access EKS clusters.

Step 1: Authenticate AWS CLI and Retrieve Cluster Details
  1. First, ensure an SSO session is configured in your local CLI:

    1. Option #1:

      1. Run the following command to initiate configuration:

      2. Copy the Access Keys shown in your AWS Access Portal:

  • The following fields can be skipped:
    SSO registration scopes [sso:account:access]
    CLI default output format [None]

  • After configuration is complete, you should use --profile <your_profile_name> at the end of every aws CLI commands from this point on.

b. Option #2:

  • Within the access keys in the access portal shown above, you will find the following block of commands, copy and paste it in your terminal:

  1. Now, open a terminal and ensure your AWS CLI session is active:

  2. Retrieve the list of EKS clusters available to your account:

  3. Select the desired cluster from the output.

Step 2: Update kubectl Configuration

To interact with your EKS cluster, you need to update the kubectl configuration.

  1. Run the following command to generate the kubeconfig:

  2. Verify connectivity by running:

    This should return a list of nodes in the cluster.

Step 3: Access the Cluster Using Lens (Kubernetes IDE)
Where is the kubeconfig?
  • Linux/Mac: ~/.kube/config

  • Windows: %USERPROFILE%\.kube\config

Lens automatically scans this file.

To check what contexts you have:

kubectl config get-contexts
kubectl config current-context
Add cluster in Lens
  • Open Lens.

  • Go to Clusters → Add Cluster.

  • Lens shows all contexts from your kubeconfig.

  • Select your EKS cluster context (looks like arn:aws:eks:region:account:cluster/<name>).

  • Click Add Cluster → Open it.