Skip to main content
Boost your DevOps efficiency! Dive into our latest white paper.Read Now

Connect to your EKS cluster

To connect to an Amazon EKS (Elastic Kubernetes Service) cluster from your local computer, follow these steps:

Prerequisites

Ensure you have the following tools installed and configured:

Authenticate with AWS

Ensure your AWS CLI is configured with credentials and the correct region:

aws configure

Provide your:

  • AWS Access Key ID
  • AWS Secret Access Key
  • Default region (e.g., us-west-2)

Update kubeconfig

Run the following AWS CLI command to update your kubeconfig with the EKS cluster details:

aws eks update-kubeconfig --region <region> --name <cluster-name>

Replace <region> with the region where your cluster is deployed (e.g., us-west-2) and <cluster-name> with the name of your EKS cluster.

This command updates or creates the ~/.kube/config file on your computer, allowing kubectl to interact with your cluster.

Verify the Connection

Test the connection by running:

kubectl get nodes

If the cluster is correctly configured and accessible, you’ll see a list of the cluster’s nodes.

Troubleshooting

  • Ensure IAM Permissions: The AWS user or role you’re using must have eks:DescribeCluster permissions to retrieve cluster details.

  • Check IAM Authentication: Ensure the IAM entity you’re using is associated with a role in the cluster’s aws-auth ConfigMap. For example:

apiVersion: v1
kind: ConfigMap
metadata:
name: aws-auth
namespace: kube-system
data:
mapRoles: |
- rolearn: arn:aws:iam::&lt;account-id&gt;:role/&lt;role-name&gt;
username: admin
groups:
- system:masters

Once these steps are complete, you should be able to interact with your EKS cluster from your computer using kubectl.

Can't find what you need?