Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing redirect on m5/c5 instances #130

Merged
merged 1 commit into from
Mar 26, 2018

Conversation

mikkeloscar
Copy link
Contributor

@mikkeloscar mikkeloscar commented Mar 14, 2018

The AWS metadata service works differently on new instance types like
m5.large and c5.large.

The behavior on old instances is that if you call:

169.254.169.254/latest/meta-data/iam/security-credentials

It will redirect to:

169.254.169.254/latest/meta-data/iam/security-credentials/

Which will respond with the IAM role name.

On new instances there is no redirect, it just responds with the IAM role name directly.

Since kube2iam didn't intercept the URL without the slash, the pod will
initially get the worker node role and then try to request credentials for that
role, which kube2iam will deny.

Fix is to intercept both versions of the URL.

Fix #127

The AWS metadata service works differently on new instance types like
m5.large and c5.large.

The behavior on old instances is that if you call:

```
169.254.169.254/latest/meta-data/iam/security-credentials
```

It will redirect to:

```
169.254.169.254/latest/meta-data/iam/security-credentials/
```

Which will respond with the IAM role name.

On new instances there is no redirect, it just responds with the IAM role name directly.

Since kube2iam didn't intercept the URL without the slash, the pod will
initially get the worker node role and then try to request credentials for that
role, which kube2iam will deny.

Fix is to intercept both versions of the URL.

Fix jtblin#127
@coveralls
Copy link

coveralls commented Mar 14, 2018

Coverage Status

Coverage remained the same at 18.482% when pulling 2650652 on mikkeloscar:fix-redirect-m5-c5 into 7ebf457 on jtblin:master.

@mikkeloscar
Copy link
Contributor Author

I realized similar fixes are in #119 and #121 but they were not referenced in #127

@jtblin jtblin merged commit 128acb7 into jtblin:master Mar 26, 2018
eaceaser pushed a commit to eaceaser/kube2iam that referenced this pull request Jun 12, 2018
The AWS metadata service works differently on new instance types like
m5.large and c5.large.

The behavior on old instances is that if you call:

```
169.254.169.254/latest/meta-data/iam/security-credentials
```

It will redirect to:

```
169.254.169.254/latest/meta-data/iam/security-credentials/
```

Which will respond with the IAM role name.

On new instances there is no redirect, it just responds with the IAM role name directly.

Since kube2iam didn't intercept the URL without the slash, the pod will
initially get the worker node role and then try to request credentials for that
role, which kube2iam will deny.

Fix is to intercept both versions of the URL.

Fix jtblin#127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants