How to connect/operate AWS EKS remotely

Prerequisites:

  1. You have already created EKS cluster.
  2. You already have worker nodes added.
  3. You have kubeclt command lines.

First we should setup our AWS account remotely to interact with its services. For this we need AWS CLI.

The AWS Command Line Interface (AWS CLI) is an open source tool that enables you to interact with AWS services using commands in your command-line shell.

The AWS CLI is available in two versions:

Version 1.x Stable verions, generally used for production environment Version 2.x A new version, still under testing phase so mostly being used for test or evaluation.

With minimal configuration, the AWS CLI enables you to start running commands that implement functionality equivalent to that provided by the browser-based AWS Management Console from the command prompt in your favorite terminal program.

For installing AWS CLI please refere install AWS CLI

Once AWS CLI is installed, we can configure the AWS CLI from here.

Once CLI is configured, we are good to configure our EKS and create/update the kubeconfig file as follow


aws eks --region [your-region] update-kubeconfig --name [cluster_name]

It will create the kubeconfig file if doesn't exist or update if you already have kubeconfig file. It will automatically set the current-context for your kubectl to EKS cluster_name.

Test your configuration:


kubectl get svc

Output should be as follow:


NAME             TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
svc/kubernetes   ClusterIP   10.100.0.1   <none>        443/TCP   1m

We have successfully connected with EKS Cluster.

If this doesn't work, the follow the article again.

For more details please refere AWS Docs.