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

kubelogin may not work with MSI when run in Azure Container Instance #79

Open
weinong opened this issue Feb 11, 2022 · 1 comment
Open

Comments

@weinong
Copy link
Contributor

weinong commented Feb 11, 2022

Problem

Although kubelogin addresses kubernetes/kubernetes#86410 to remove spn: prefix in audience claim, you may encounter the same issue while using kubelogin with Managed Service Identity (MSI) in Azure Container Instance (ACI).

For example

az login --identity --username ${MSI_CLIENT_ID}
kubelogin convert-kubeconfig -l azurecli
kubectl get pods
error: You must be logged in to the server (Unauthorized)

## If `guard` log is enabled in AKS control plane, you will see
## failed to verify token for azure: oidc: expected audience "6dae42f8-4368-4678-94ff-3960e28e3630" got ["spn:6dae42f8-4368-4678-94ff-3960e28e3630"]

The issue is in ACI where they have different infrastrucutres such that the returned MSI token on legacy one will include spn: prefix in audience claim. You can verify by examining the AAD token by kubelogin get-token --server-id 6dae42f8-4368-4678-94ff-3960e28e3630 --client-id ${MSI_CLIENT_ID} --login msi and paste the access token to https://jwt.ms and look at the audience claim. If it has spn:, your ACI is running on the legacy infrastructure.

Mitigation

Please open support request to ACI team to migrate your subscription

References

#30 #61

@weinong weinong added bug Something isn't working known issue and removed bug Something isn't working labels Feb 11, 2022
@weinong weinong changed the title [known issue] kubelogin may not work with MSI when run in Azure Container Instance kubelogin may not work with MSI when run in Azure Container Instance Feb 12, 2022
@djsly
Copy link

djsly commented Sep 30, 2022

@weinong do you know if we still need to request a migration for our subs or this is now fixed for all subs ?

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

No branches or pull requests

2 participants