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

Support for exposing the kubelet identity for AKS cluster with MSI #6371

Closed
aristosvo opened this issue Apr 6, 2020 · 6 comments · Fixed by #6393
Closed

Support for exposing the kubelet identity for AKS cluster with MSI #6371

aristosvo opened this issue Apr 6, 2020 · 6 comments · Fixed by #6393

Comments

@aristosvo
Copy link
Collaborator

aristosvo commented Apr 6, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

For the MSI it would make sense to also expose the identity profile with kubelet identity.

One of the reasons to add this is for aad-pod-identity enablement, as role assignments must be set on this identity in order to use aad-pod-identity, as described here.

A tutorial on aad-pod-identity with MSI on AKS with an example application can be found here, it will be updated or extended to configuration with TerraForm after this issue is fixed.

The kubelet identity is exposed from the API:

"identityProfile": {
    "kubeletidentity": {
      "clientId": "00000000000000000000000000000000",
      "objectId": "0000000000000000000000000000000",
      "resourceId": "/subscriptions/00000000000000000000000/resourcegroups/MC_xxxxxxxx_westeurope/providers/Microsoft.ManagedIdentity/userAssignedIdentities/xxxxxx-agentpool"
    }
  },

New or Affected Resource(s)

  • azurerm_kubernetes_cluster

Potential Terraform Configuration

The identity_profile block exports the following:

  • kubelet_identity - A kubelet_identity block

The kubelet_identity block exports the following:

  • client_id - The client id of the user-defined Managed Identity of the kubelet.
  • object_id - The object id of the user-defined Managed Identity of the kubelet.
  • resource_id - The resource id of the user-defined Managed Identity of the kubelet.

References

@jmcshane
Copy link
Contributor

jmcshane commented Apr 7, 2020

Just to leave a comment on why this is important, role assignments must be set on this identity in order to use aad-pod-identity, as described here: https://github.com/Azure/aad-pod-identity/blob/master/docs/readmes/README.msi.md#pre-requisites---role-assignments

The workaround that I am doing right now is adding a datasource that pulls in the user assigned identity from the MC resource group after AKS cluster provisioning.

@aristosvo
Copy link
Collaborator Author

@jmcshane Thanks! That's my use case as well, I added it to the description.

I've probably time tomorrow to make a PR to implement this functionality.

@syedhassaanahmed
Copy link

syedhassaanahmed commented Apr 16, 2020

Many thanks for the PR @aristosvo

We also ran into this while trying to use AAD Pod Identity. As part of the PR, Can you please also export the Kubelet Identity in Data Source: azurerm_kubernetes_cluster?

@tombuildsstuff tombuildsstuff added this to the v2.6.0 milestone Apr 16, 2020
@aristosvo
Copy link
Collaborator Author

@syedhassaanahmed Thanks! I’ll take a look tonight or tomorrow, I hope the PR is merged by then so I’ll probably add a separate PR for the data source.

@ghost
Copy link

ghost commented Apr 16, 2020

This has been released in version 2.6.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.6.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented May 17, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators May 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants