'How to connect to azure kubernetes API?

I've deployed in Azure a cluster kubernetes with Azure Ad Integration and RBAC. I'm trying to use the kubernetes api using a user account but I don't know how to get a authentification token.

In order to get the kubernetes config file, I'm calling the azure api endpoint "ListCLusterUserCredentials" (https://docs.microsoft.com/fr-fr/rest/api/aks/managed-clusters/list-cluster-user-credentials). But no token is provided in the encoded file.

It works perfectly with the endpoint "ListCLusterAdminCredentials". The config file contains a token that could be used to be authenticated to the kubernetes api. But I don't want give access to the users to this endpoint. There are not suppose to get admin cred if they are only users with read mode.

Do you know how to handle this type of connection ?



Solution 1:[1]

Instead of using ListCLusterAdminCredentials, I use listClusterMonitoringUserCredential to get access token to connect to Kubernetes API endpoints.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeremy Caney