I have a cluster in AWS EKS and 1 node group which has 1 node, how to display node and pods using aws api? I have credentials for service account, how to use these credentials in an API and get list of available nodes and pods?
when I try to execute command kubectl get pods
it shows an error:
An error occurred (AccessDenied) when calling the AssumeRole operation: User: >arn:aws:iam:xxxx:user/xx is not authorized to perform: sts:AssumeRole on resource: >arn:aws:iam::xx:user/xx
You need to do two things before accessing your cluster.
Add your IAM Roles or Users to the aws-auth ConfigMap to configure who can access the cluster. The IAM role that was used for creating the cluster, already have access.
When accessing the cluster, you must authenticate and populate your kubeconfig
. This can be done with aws eks update-kubeconfig command:
aws eks update-kubeconfig --name <my-cluster-name>