Bobcares

Can’t connect to EKS Cluster – Configure kubeconfig file

by | Sep 2, 2021

Can’t connect to EKS Cluster? We can help you.

Recently, one of our customers created an Amazon EKS cluster. However, he fails to connect to the cluster.

Here, at Bobcares, we assist our customers with several AWS queries as part of our AWS Support Services.

Today, let us see how we can fix this error.

Can’t connect to EKS Cluster

Once we create the Amazon EKS cluster, we must configure the kubeconfig file with AWS CLI. This will allow us to connect to the cluster via the kubectl command line.

In this article, we discuss how to create a kubeconfig file for the cluster.

To begin, we make sure that we use the most recent AWS CLI version.

How to fix this issue?

1. First and foremost, we make sure to install AWS CLI version 1.16.308 or greater:

$ aws --version

However, we need to have Python version 2.7.9 or greater on the system. Otherwise, we may receive an error.

2. Then to verify if we use the correct credentils, we check the current identity:

aws sts get-caller-identity

The AWS IAM entity user or role that creates an Amazon cluster automatically has permissions when we create the cluster.

By default, the AWS IAM Authenticator for Kubernetes uses the AWS CLI or AWS SDK identity.

3. Now, we need to create or update the kubeconfig file for the cluster:

aws eks --region region update-kubeconfig --name cluster_name

By default, the configuration file is created at the kubeconfig path ($HOME/.kube/config) in the home directory. Or it merges with an existing kubeconfig at that location.

In addition, we can specify another path by setting the KUBECONFIG environment variable, or with the following option:

$ kubectl get pods --kubeconfig ./.kube/config

For authentication, when we run kubectl commands, we can specify an IAM role Amazon Resource Name (ARN).

Otherwise, it usesthe IAM entity in the default AWS CLI or AWS SDK credential chain.

4. Finally, we test the configuration:

$ kubectl get svc

An example of the output will look like this:

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

[Need help with the resolution? We are here for you]

Conclusion

In short, we saw how our Support Techs fix the EKS Cluster issue.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.