Skip to content

Commit

Permalink
fix: AWS IMDSv2 support added (#46582)
Browse files Browse the repository at this point in the history
  • Loading branch information
helbertonepoint committed Aug 23, 2024
1 parent f90a899 commit 912ff2d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ fi
# RKE pull request: https://github.com/rancher/rke/pull/2803
if [ "$1" = "kube-proxy" ] || [ "$1" = "kubelet" ]; then
if echo ${@} | grep -v "hostname-override"; then
hostname=$(curl "http://169.254.169.254/latest/meta-data/hostname")
aws_api_token=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 60")
hostname=$(curl -H "X-aws-ec2-metadata-token: $aws_api_token" "http://169.254.169.254/latest/meta-data/hostname")
if [ -z "$hostname" ]; then
hostname=$(hostname -f)
fi
Expand Down

0 comments on commit 912ff2d

Please sign in to comment.