- Newest
- Most votes
- Most comments
Hello,
Regarding the error message you receive ("AccessDeniedException: User: arn:aws:sts::XX:assumed-role/NODE_IAM_ROLE/NODE_NAME is not authorized to perform: ACTION"), it's pretty important whether "ACTION" is an "sts:AssumeRole" or anything else. As in the former case it was kube2iam failed to assume the role (hence you need to check kube2iam's logs), while the latter means the role was assumed but lacking some privileges.
One of the likely reasons are setting up the re-routing rule for IMDS. The command curl 169.254.169.254/latest/meta-data/local-ipv4 will not work in AL2023, as it only accepts IMDSv2 queries [1] (requiring an access token to be used with the query, see [2]), while it worked in AL2.
To make it IMDSv2-aware, you can either use the "imds" utility (available on most AL2023 AMIs) or the method described on reference [2] in order to gain and use access token with your query.
I.e. getting the local IPV4 address, you can use one of the methods below:
LOCAL_IPV4=`imds latest/meta-data/local-ipv4`
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
LOCAL_IPV4=`curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/local-ipv4`
References:
[1] IMDSv2 - https://docs.aws.amazon.com/linux/al2023/ug/imdsv2.html
[2] How Instance Metadata Service Version 2 works - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-metadata-v2-how-it-works.html
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 7 months ago
