Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Find common link between AKS and k8s assets data #174

Open
MichaelKatsoulis opened this issue May 15, 2023 · 0 comments
Open

Find common link between AKS and k8s assets data #174

MichaelKatsoulis opened this issue May 15, 2023 · 0 comments
Labels
question Further information is requested

Comments

@MichaelKatsoulis
Copy link
Collaborator

There is no azure data collector yet.
I am opening this issue as a place to put some thoughts after investigation.

When an AKS cluster is created two resource groups are created. One named by the user which holds only the kubernetes service as a resource and a second one.
The second one is called node resource group and if its name is not explicitly set by the user on cluster creation it follows a pattern like MC_myResourceGroup_myAKSCluster_eastus.
This node resource group holds the resources needed by the cluster including the virtual machines scaling set.

Interestingly the actual virtual machines are not listed so probably they won't be collected by an asset collector.

The kubernetes node itself when running kubectl describe node aks-agentpool-83092173-vmss000000 gives a ProviderID like

 "id": "/subscriptions/<sub_id>/resourceGroups/<noderesourcegroup>/providers/Microsoft.Compute/virtualMachineScaleSets/aks-agentpool-83092173-vmss/virtualMachines/0"

From the part of the aks collector we can get the node resource group by describing the cluster.

az aks show --name michaliskatsoulistestcluster -g michaliskatsoulisgroup
...
"nodeResourceGroup": "MC_michaliskatsoulisgroup_michaliskatsoulistestcluster_eastus",
...

Then we can use this noderesourcegroup to list the virtual machine scaling sets under it and get the scaling set name.

az vmss list --resource-group MC_michaliskatsoulisgroup_michaliskatsoulistestcluster_eastus

...
"name": "aks-agentpool-83092173-vmss",
...

Then by listing the instances of that scaling set we can get the virtual machines (as given by ProvideId)

az vmss list-instances --resource-group MC_michaliskatsoulisgroup_michaliskatsoulistestcluster_eastus --name aks-agentpool-83092173-vmss  | grep virtualMachines

@girodav girodav added the question Further information is requested label Jun 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants