How to remove label from a cluster role binding.

VL 1 Reputation point
2022-11-10T14:50:34.093+00:00

How to remove label from a cluster role binding.

I have a clusterrolebinding that I needed to update by removing one of the subjects --> user. If I edit or delete, the cluster role bindings, it is getting recreated. I am assuming that is because it has a label "addonmanager.kubernetes.io/mode: Reconcile". Updating the role binding to remove the label doesnt help either. It gets re-added.

I tried the following commands with no effect:
kubectl auth reconcile -f remove_clusterUser.yml
kubectl edit clusterrolebinding aks-cluster-admin-binding

Please let me know how do I update the clusterrolebinding without it getting reconciled.

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,145 questions
{count} votes

1 answer

Sort by: Most helpful
  1. KarishmaTiwari-MSFT 20,207 Reputation points Microsoft Employee
    2022-11-17T01:48:56.617+00:00

    Hello @VL ,

    Based on my understanding of your scenario, I see that you are trying to update content of AKS managed Kubernetes objects. This is not supported and thus AKS always tries to reconcile the values back to AKS supplied values.

    You are seeing clusterUser as "admin", it typically means that you have not enabled AAD based authentication for the cluster. Let me know if that is not the case and I can investigate further.

    All users that have access to az aks get-credential is considered admin, when AAD integration is not enabled.

    So I would recommend that instead of removing user from the binding, you can enable AAD integration, which gives diverse identities to each user.

    Reference documentation: https://learn.microsoft.com/en-us/azure/aks/managed-aad
    https://learn.microsoft.com/en-us/azure/aks/faq

    ----------

    If this answers your query, do click “Accept the answer” and Up-Vote for the same, which might be beneficial to other community members reading this thread.
    And, if you have any further query, do let me know in the comments.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.