Where to find Kubernetes API credentials with AKS?

11/17/2017

I'm trying to follow this guide to setting up a K8s cluster with external-dns' Azure DNS provider. The guide states that:

When your Kubernetes cluster is created by ACS, a file named /etc/kubernetes/azure.json is created to store the Azure credentials for API access. Kubernetes uses this file for the Azure cloud provider.

When I create a cluster using aks (e.g. az aks create --resource-group myResourceGroup --name myK8sCluster --node-count 1 --generate-ssh-keys) this file doesn't exist.

Where do the API credentials get stored when using AKS?

Essentially I'm trying to work out where to point this command:

kubectl create secret generic azure-config-file --from- file=/etc/kubernetes/azure.json

-- rh072005
azure
azure-container-service
kubernetes

3 Answers

11/17/2017

Use this command to get credentials:

az aks get-credentials --resource-group myResourceGroup --name myK8sCluster

Source:
https://docs.microsoft.com/en-us/azure/aks/kubernetes-walkthrough

-- 4c74356b41
Source: StackOverflow

10/5/2019

Did you try this command ?

cat ~/.kube/config

It provided all i needed for my CI to connect to the Kubernetes Cluster and use API

-- Bliv_Dev
Source: StackOverflow

11/20/2017

From what I can see when using AKS the /etc/kubernetes/azure.json doesn't get created. As an alternative I followed the instructions for use with non Azure hosted sites and created a service principal (https://github.com/kubernetes-incubator/external-dns/blob/master/docs/tutorials/azure.md#optional-create-service-principal)

Creating the service principal produces some json that contains most of the detail. This can be used to manually create the azure.json file and the secret can be created from it.

-- rh072005
Source: StackOverflow