I am trying to run “kubectl get nodes” but every time i do get an error
I have ensured trust relationships with user
kube configs are good
roles have permissions and correct policies attached
every amazoneks permission has been added to my user role but no matter what i do i cant get this to run successfully
I have been searching chatgpt, stack overflow, youtube, google and i cant seem to find a resolution, I am pretty new with this so any help is greatly appreciated
here are my steps
-
aws configure:
enter in access key, secretkey, region and use json -
aws sts assume-role --role-arn arn:aws:iam::##########:role/zontal-dev-manager --role-session-name zontalSession
(replaced # with actual id)
export AWS_ACCESS_KEY_ID=YourAccessKeyID
export AWS_SECRET_ACCESS_KEY=YourSecretAccessKey
export AWS_SESSION_TOKEN=YourSessionToken
-
verify trust relationship for user
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "eks.amazonaws.com" }, "Action": "sts:AssumeRole" }, { "Effect": "Allow", "Principal": { "Service": "ec2.amazonaws.com" }, "Action": "sts:AssumeRole" }, { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::#########:user/zontal_admin" }, "Action": "sts:AssumeRole" } ] }
-
created i am policy for user
-
update kubeconfig
aws eks update-kubeconfig –region eu-central-1 –name zontal-cluster –role-arn
arn:aws:iam::#########:role/zontal-dev-manager
7.ensure im using correct context
kubectl config use-context arn:aws:eks:eu-central-1:##########:cluster/zontal-cluster
- run code “kubectl get nodes” after running this is when i get the error
ERROR:
[ec2-user@ip-10-0-1-241 .kube]$ kubectl get nodes
E0808 16:31:54.884767 59574 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0808 16:31:56.027300 59574 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0808 16:31:57.189961 59574 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0808 16:31:58.058464 59574 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E0808 16:31:58.965299 59574 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)