I have set up a AKS cluster from portal. With Kubernets RBAC enabled but no integration with AAD.
When i am logged in with my user(which is also cluster admin) and perform az aks get-credentials --name <cluster-name> --resource-group <resource-group>
Context is added to ./kube/config file and from there i copied the client-certificate-data field, decoded it and found out that CN = masterclient O = system:masters
is what my certificate has. In AKS there is an existing ClusterRoleBinding which allows the access to all the cluster for the users with group system:masters.
Now i added a ServicePrincipal and assigned it below roles only on the AKS cluster.
Now when i do az login --service-principal --username <sp_name> --password <pwd> --tenant <tenant_id>
and
az aks get-credentials --name <cluster-name> --resource-group <resource-group>
I figured out that same system:masters
is being set as the group in the client-certificate-data and having full access to the cluster.
Is this behavior correct? Shouldn't it be like that CN and Group in certificate data be different to master and we would then need additional Role/ClusterRole Bindings to manage them?.