Skip to content

Commit

Permalink
Merge pull request #206 from sebastien-helbert/feat/46582-support-imdsv2
Browse files Browse the repository at this point in the history
fix: AWS IMDSv2 support added (#46582)
  • Loading branch information
chiukapoor authored Aug 30, 2024
2 parents 817e581 + 912ff2d commit b6e5651
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 b6e5651

Please sign in to comment.