I created an Amazon EKS cluster using the root account by uploading the respective CloudFormation Template (CFT). The EKS cluster was created successfully.
However, when I try to connect to the cluster using the kubectl CLI with an IAM user account that has admin rights configured via aws configure, I encounter the following errors:
kubectl get po
E0806 13:13:07.106017 18182 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0806 13:13:07.746093 18182 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0806 13:13:08.385555 18182 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0806 13:13:09.037252 18182 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0806 13:13:09.686036 18182 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
error: You must be logged in to the server (the server has asked for the client to provide credentials)
Upon investigation, I discovered that the issue is related to the root account. To resolve this, I understand that the EKS cluster should ideally be created using a non-root user. Afterward, I need to add other user accounts and IAM roles in the aws-auth config map for authentication.
My question is: How can I connect to the EKS cluster for the first time when it is created using the root account? What steps should I take to properly configure access for other IAM users?
Any guidance on resolving this issue would be greatly appreciated!