Connect kubectl to an EKS cluster by creating a kubeconfig file

0 votes
I’m connecting kubectl to my Amazon EKS cluster, but I’m confused about how the Kubeconfig file works. Could you guide me through creating and setting it up?
Oct 23 in AWS by Priyanka
• 4,080 points
63 views

1 answer to this question.

0 votes

Prerequisites

Before you begin, ensure you have the following:

  • Make sure your current AWS CLI version is 2.12.3 or version 1.27.160. So check your current version.

                    image

  • Install the kubectl command-line tool on your device or AWS CloudShell. Its version must match your cluster's Kubernetes version or be one minor version earlier or later.

  • An IAM user or role with permission to use the eks: DescribeCluster API action for the specified cluster.

Here are the steps to Create or Update kubeconfig:

  • Find the name of your EKS cluster and the AWS Region where it is located.

  • Execute the following command to create or update your kubeconfig file in AWS CLI Command:

                   image

                Replace <region-code> with the AWS Region of your cluster and <my-cluster> with your cluster's name.

  • The default configuration file is saved at ~/.kube/config. To use a different path, specify with --kubeconfig.

  • To use a specific IAM role for authentication, add --role-arn. If not specified, the default AWS CLI credentials are used. Check your current identity by running this:

                        image

  • For all available options and further details, run.

              image

  • Test your configuration by running:

                image

  • If successful, you'll see output like this:

                image

           For more information click here.

answered Oct 25 by Dhvani

Related Questions In AWS

0 votes
1 answer

How do I write an S3 Object to a file?

While IOUtils.copy() and IOUtils.copyLarge() are great, I would prefer the old ...READ MORE

answered Jul 13, 2018 in AWS by Hammer
• 360 points
4,642 views
0 votes
2 answers

How to skip headers when reading a CSV file in S3 and creating a table in AWS Athena?

Thanks for the answer. This should be clear ...READ MORE

answered Aug 14, 2019 in AWS by athenauserz
11,833 views
0 votes
2 answers
0 votes
0 answers

How to upload a file in to aws s3 by using programmatically??

Sep 13, 2019 in AWS by anonymous

closed Sep 16, 2019 by Kalgi 3,897 views
0 votes
1 answer

permissions related to AWS ECR

if you add allowContainerRegistry: true, kops will add those permissions ...READ MORE

answered Oct 9, 2018 in Kubernetes by Kalgi
• 52,350 points
1,396 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
15,476 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP