amazon-web-servicesterraformamazon-eks

error while applying kubernetes from yml file


kubectl apply -f k8s/deployment.yml --validate=false

An error occurred (AccessDenied) when calling the AssumeRole operation: User: <user arn> is not authorized to perform: sts:AssumeRole on resource: <cluster role arn>
E1111 21:37:30.036257   14704 memcache.go:265] couldn't get current server API group list: Get "https://5E52EE866A68FF445D9EFF54FF06C3FF.gr7.ap-south-1.eks.amazonaws.com/api?timeout=32s": getting credentials: exec: executable aws failed with exit code 254
error: unable to recognize "k8s/deployment.yml": Get "https://5E52EE866A68FF445D9EFF54FF06C3FF.gr7.ap-south-1.eks.amazonaws.com/api?timeout=32s": getting credentials: exec: executable aws failed with exit code 254

kubectl apply -f k8s/clusterrolebinding.yml --validate=false

An error occurred (AccessDenied) when calling the AssumeRole operation: User: <<user arn>> is not authorized to perform: sts:AssumeRole on resource: <<cluster role arn>>
E1112 12:33:01.210734   35556 memcache.go:265] couldn't get current server API group list: Get "https://5E52EE866A68FF445D9EFF54FF06C3FF.gr7.ap-south-1.eks.amazonaws.com/api?timeout=32s": getting credentials: exec: executable aws failed with exit code 254
error: unable to recognize "k8s/clusterrolebinding.yml": Get "https://5E52EE866A68FF445D9EFF54FF06C3FF.gr7.ap-south-1.eks.amazonaws.com/api?timeout=32s": getting credentials: exec: executable aws failed with exit code 254 

I tried creating default, role and cluster role binding ,even those are givin the same errors.


Solution

  • This worked by adding an access entry point to my cluster

    where ?

    eks > clusters >  Access > IAM Access entries > Create an access entry.