25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

Need help?

Our experts have had an average response time of 11.43 minutes in March 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Unauthorized server error while connecting to EKS API server

by | Sep 2, 2021

Stuck with unauthorized server error while connecting to EKS API server? We can help you.

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 resolve it.

How to resolve unauthorized server error while connecting to EKS API server?

Firstly, connect to the Amazon EKS API server, install and configure the latest version of the AWS CLI.

Then, the cluster admin must complete the steps in one of the following sections:

  • You’re the cluster creator
  • You’re not the cluster creator

Finally, the person who received the error must complete the steps in the You’re the user or role that received the error section.

Today, let us see the steps followed by our Support techs to resolve it.

 

You’re the cluster creator

1. To see the configuration of your AWS CLI user or role, run the following command:

$ aws sts get-caller-identity

The output returns the Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) user or role. For example:

{
"UserId": "XXXXXXXXXXXXXXXXXXXXX",
"Account": "XXXXXXXXXXXX",
"Arn": "arn:aws:iam::XXXXXXXXXXXX:user/testuser"
}

2. Then, confirm that the ARN matches the cluster creator.

3. Next, update or generate the kubeconfig file using one of the following commands.

As the IAM user, run the following command:

$ aws eks update-kubeconfig --name eks-cluster-name --region aws-region

Note: Replace eks-cluster-name with your cluster name. Replace aws-region with your AWS Region.

As the IAM role, run the following command:

$ aws eks update-kubeconfig --name eks-cluster-name --region aws-region --role-arn arn:aws:iam::XXXXXXXXXXXX:role/testrole

Note: Replace eks-cluster-name with your cluster name. Replace aws-region with your AWS Region.

4. To confirm that the kubeconfig file is updated, run the following command:

$ kubectl config view --minify

5. To confirm that your IAM user or role is authenticated, run the following command:

$ kubectl get svc

The output should be similar to the following:

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.100.0.1  443/TCP 77d

You’re not the cluster creator

1. To see the configuration of your AWS CLI user or role, run the following command:

$ aws sts get-caller-identity

The output returns the ARN of the IAM user or role.

2. Ask the cluster owner or admin to add your IAM user or role to aws-auth ConfigMap.

Note: You can also use AssumeRole to log in as the cluster creator if you have the correct IAM permissions.

3. To edit aws-auth ConfigMap in a text editor, the cluster owner or admin must run the following command:

$ kubectl edit configmap aws-auth -n kube-system

4. To add an IAM user or IAM role, complete either of the following steps.

Add the IAM user to mapUsers. For example:

mapUsers: |
- userarn: arn:aws:iam::XXXXXXXXXXXX:user/testuser
username: testuser
groups:
- system:masters

Add the IAM role to mapRoles. For example:

mapRoles: |
- rolearn: arn:aws:iam::XXXXXXXXXXXX:role/testrole
username: testrole
groups:
- system:masters

You’re the user or role that received the error

1. To update or generate the kubeconfig file after aws-auth ConfigMap is updated, run either of the following commands.

As the IAM user, run the following command:

$ aws eks update-kubeconfig --name eks-cluster-name --region aws-region

Note: Replace eks-cluster-name with your cluster name. Replace aws-region with your AWS Region.

2. As the IAM role, run the following command:

$ aws eks update-kubeconfig --name eks-cluster-name --region aws-region --role-arn arn:aws:iam::XXXXXXXXXXXX:role/testrole

Note: Replace eks-cluster-name with your cluster name. Replace aws-region with your AWS Region.

3. To confirm that the kubeconfig file is updated, run the following command:

$ kubectl config view --minify

4. To confirm that your IAM user or role is authenticated, run the following command:

$ kubectl get svc

You should see output similar to the following:

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.100.0.1  443/TCP 77d

[Need help with more AWS queries? We’d be happy to assist]

Conclusion

In short, today we discussed the steps followed by our Support Engineers  to resolve Unauthorized server error while connecting to EKS API server.

0 Comments

Submit a Comment

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

Categories

Tags

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF