Description
Describe the bug
It seems that the role parameter in aws eks update-kubeconfig --role arn:aws:iam::1234567890:role/ASSUMEDROLE
is only being inserted in to kube config and used for kubectl connection, but not aws eks
command for retrieving kubeconfig.
My use case: I have 2 AWS accounts with one eks cluster in each account. I would like to manage both clusters with account A's credential without switching back and forth accounts. So I have setup a role (ASSUMEDROLE) in account B with AssumeRole permission from a role from account A. Everything works fine except the update-kubeconfig
command for cluster B in account B. I expect to get the cluster B kubeconfig by running aws eks update-kubeconfig --name clusterB --role arn:aws:iam::ACCOUNTB#:role/ASSUMEDROLE
, where aws cil should use the ASSUMEDROLE in account B to connect and retrieve the config and also insert the role to kubeconfig user get-token
command.
Currently, I have to create a new AWS profile and specify the role_arn to ASSUMEDROLE and source as account A profile and run aws eks update-kubeconfig --name clusterB --role arn:aws:iam::ACCOUNTB#:role/ASSUMEDROLE --profile=NEWPROFILE
to get the config. However, it will also double assumes the role as the NEWPROFILE environment var is also added to kubeconfig generated by the command.
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
args:
- --region
- ca-central-1
- eks
- get-token
- --cluster-name
- clusterB
- --role
- arn:aws:iam::ACCOUNTB#:role/ASSUMEDROLE
- --output
- json
command: aws
env:
- name: AWS_PROFILE
value: newprofile
The workaround is to remove --role
in the update-kubeconfig
command. However, I would like to just use a single profile. If the --role
parameter is actually being used for aws eks connection, it would solve this problem.
This is also an inconsistent behavior than other commands. e.g. aws eks get-token --role
, where the role was actually used for the aws eks
command connection.
Others are also having into this issue:
#5823
#6389
Expected Behavior
I expect to get the cluster B kubeconfig by running aws eks update-kubeconfig --name clusterB --role arn:aws:iam::ACCOUNTB#:role/ASSUMEDROLE
, where aws cil should use the ASSUMEDROLE in account B to connect and retrieve the config and also insert the role to kubeconfig user get-token
command.
Current Behavior
The command only insert the role into kubeconfig, but not using the role for AWS CLI connection
Reproduction Steps
Described in description above
Possible Solution
No response
Additional Information/Context
No response
CLI version used
aws-cli/2.15.17 Python/3.11.6 Darwin/23.3.0 exe/x86_64 prompt/off
Environment details (OS name and version, etc.)
OSX 14.3 (23D56)