kube2iam icon indicating copy to clipboard operation
kube2iam copied to clipboard

kube2iam:2.6.0 not working with metadata version v2

Open AS011 opened this issue 4 years ago • 15 comments

Hi @jtblin I am using kube2iam-2.6.0 with EKS version 1.17+ when i deploy the kube2iam pod it goes in crashloopbackoff with the error as time="2021-02-10T08:04:19Z" level=fatal msg="EC2 Metadata is not available, are you running on EC2?" . Whereas the ec2 instance seems to be running . Do i need to change anything in setup i have also added the following in instance user data

TOKEN=curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/ curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/ami-id

AS011 avatar Feb 10 '21 08:02 AS011

Have you set up the iptable rules as per the README?

On Wed, 10 Feb 2021, 7:08 pm Aman Seth, [email protected] wrote:

Hi @jtblin https://github.com/jtblin I am using kube2iam-2.6.0 with EKS version 1.17+ when i deploy the kube2iam pod it goes in crashloopbackoff with the error as time="2021-02-10T08:04:19Z" level=fatal msg="EC2 Metadata is not available, are you running on EC2?" . Whereas the ec2 instance seems to be running . Do i need to change anything in setup i have also added the following in instance user data

TOKEN=curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600" && curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/ curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/ami-id

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jtblin/kube2iam/issues/300, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKTDLT2744JKW5OZRYMGA3S6I5GXANCNFSM4XMPMO5Q .

jtblin avatar Feb 10 '21 20:02 jtblin

@jtblin Even with --iptables=true we still see the same error msg

kkapoor1987 avatar Mar 26 '21 13:03 kkapoor1987

@jtblin We are also facing the same issue with kube2iam:2.6.0.

saithejareddy avatar Jun 28 '21 12:06 saithejareddy

Any update here? @jtblin

saithejareddy avatar Jul 27 '21 19:07 saithejareddy

@AS011 Are your worker nodes set to require meta data http tokens ? If so, I believe kube2iam is only compatible with IMDSv1.

dmbower avatar Aug 19 '21 12:08 dmbower

Hi David,

Thanks for response:

my production upgrade is blocked due to this. Have a couple clarifications.

1- How would I know if my worker nodes are set to require meta http data tokens?

2- why will IMDSv1 matter to me because I already have kube2iam working with 10.1 version and that shows no such Connect errors. Or are you saying this version of kube2iam that I am upgrading to which is 10.11 by defaults enable imdsv2? If yes how could get around and what are my options if I want to use imdsv2

Ahmed F

On Aug 19, 2021, at 5:28 AM, David Bower @.***> wrote:

 @AS011 Are your worker nodes set to require meta data http tokens ? If so, I believe kube2iam is only compatible with IMDSv1.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

ahmsb8884 avatar Aug 19 '21 14:08 ahmsb8884

Hi @jtblin .. We have just disabled IMDSv1 on our worker nodes and we face the same issue with kube2iam. Are you looking to fix this as it appears the fix may already exist in #325 . Any update will be greatly appreciated.

cmsmith7 avatar Dec 15 '21 10:12 cmsmith7

Hi @jtblin .. Any updates of it? Issue still exists.

NeunJa avatar Feb 09 '22 11:02 NeunJa

Can we please get this pushed facing same issue

razorsk8jz avatar Feb 24 '22 19:02 razorsk8jz

Also facing this issue - any timeline on this PR?

copeia avatar Apr 26 '22 20:04 copeia

I will echo the precious commenters... is there some testing/confirmation that would be useful here?

jgdef-tulip avatar May 10 '22 22:05 jgdef-tulip

@jtblin can we have this PR merged?

mozz-lx avatar Jul 20 '22 21:07 mozz-lx

This seems to be an issue especially when using it in combination with Karpenter (https://karpenter.sh/v0.24.0/concepts/node-templates/#specmetadataoptions) -> httpTokens: required. Only works when removing the default value:

metadataOptions:
  httpPutResponseHopLimit: 2

Alien2150 avatar Feb 15 '23 12:02 Alien2150

I use EKS by using eksctl. I solve this error by setting disableIMDSv1: false option on yaml. I hope kube2iam supports IMDSv2.

# yaml (https://eksctl.io/usage/schema/#)
managedNodeGroups:
  - name: ~~~
    ...
    disableIMDSv1: false # Use IMDSv1 instead of IMDSv2

hanamurayuki avatar Sep 28 '23 03:09 hanamurayuki

Thanks @Alien2150. Adding the exact option value that fixed the kube2iam issue for Karpenter nodes.

apiVersion: karpenter.k8s.aws/v1beta1
kind: EC2NodeClass
metadata:
  name: xxxxxxxx
  namespace: xxxxxxx
spec:
  metadataOptions:
    httpTokens: optional

pradeepnnv avatar Jan 23 '24 20:01 pradeepnnv