-
Notifications
You must be signed in to change notification settings - Fork 984
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
Service principal with working Azure Roles as tf context is unable to authenticate via kubernetes provider block but az aks get-credentials and kubectl get pods -n xy works #1964
Comments
One Addition I forgot to mention: The asignee of the roles Kubernetes User and Namespace RBAC Admin is not the service principal itself, but a security group "azuread_group.sg.id". The app registration/service principal is member in this group. |
Can anyone verify this issue? Its quite a blocker for us. Thanks |
I just wanted to shed a bit more light on the issue, the TLDR is that Terraform is calling a soon-to-be deprecated API. More specifically, based off the error message, the endpoint is calling:
Here's the thing: I don't think the kubernetes provider-- where this issue is-- is the right place for this. The k8s provider is just a victim. This is probably better suited under the azurerm provider. I'm going to take the above and bring it there. |
@browley86 Thank you for the analysis. Should I file the issue with the azurerm provider? |
@slzmruepp - Yes, please, if you have time. I'm buried in other things this week and probably won't get around to it. Apologies and thanks for the assist. |
@browley86 It seems I can not transfer the thread because of permissions. I am not a hashicorp member. Do you want me to copy paste the stuff? Thx |
this is an issue for the azurerm terraform provider and has been created there - closing this issue. |
Terraform Version, Provider Version and Kubernetes Version
Affected Resource(s)
Terraform Configuration Files
Steps to Reproduce
(This allows the sp-2 to do everything in its namespace: kubectl list all -n var.aks_proj_ns works, kubectl list all does not work)
This is tested with az login sp-2 and executing kubectl commands in azure pipelines, it works.
If I grant sp-2 Contributor role on the aks-resource group, it works without error, but if we then do:
we get the error kubernetes_namespace.example unauthenticated (or similar)
Only if we than change the provider setup to following:
everything works as expected. But we grant the project sp-2 which should then have limited permissions contributor rights on the aks resource group (which is a no go) and also RBAC admin on the cluster which I don't even know where this comes from, I only suspect that this is inherited from the Contributor role on the resource group.
Expected Behavior
What should have happened?
We want the sp-2 with limited permissions to only be able to see and manage the project namespace for which it has the RBAC Admin rights anyway and only deploy to this namespace kube objects through terraform.
We want the provider configuration to work as documented (the sp-2 of the tf context has Kubernetes User Role which should allow it to download the certs and auth for acting on the specific namespace.
Actual Behavior
What actually happened?
Despite the sp-2 has the appropriate roles which are verified by using az aks commands and kubectl commands to download kubeconfig and act on the specific namespace it has RBAC Admin role for, the kubernetes provider fails with 403 error.
Important Factoids
References
Community Note
The text was updated successfully, but these errors were encountered: