1

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
  • 720
  • 6
  • 15

3 Answers3

1

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
  • 720
  • 6
  • 15
0

Use this command to get credentials:

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

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

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
  • Running this command looks like it downloads something to /home/{name}/.kube/config Looking at the content of this it doesn't look like the json specified in the walkthrough. It is still possible to create the secret from this file and have it work. i.e. will "kubectl create secret generic azure-config-file --from- file=/home/{name}/.kube/config" work ? – rh072005 Nov 17 '17 at 14:34
  • Have done. I can follow that guide with no trouble. I’m trying to integrate with the external-dns service that I linked to in my original question. I need to try and surface the information created by following the steps in your guide to external-dns – rh072005 Nov 17 '17 at 15:15
  • I think I’ve solved this by creating a service principal to get the details – rh072005 Nov 17 '17 at 17:39
0

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
  • 557
  • 7
  • 19