1

I am new to Kusto. I need an query to get the current node count of all the running Azure kubernetes clusters. I have tried with below but for few clusters it is giving node count 0 where as mode is present on those

Resources
| where type == "microsoft.containerservice/managedclusters"
| extend nodepools = properties.agentPoolProfiles
| mv-expand nodepools
| project name, nodepools.name, nodepools.vmSize, nodepools.minCount, nodepools.maxCount, nodepools.powerState.code,nodeCount = tostring(nodepools['count'])
| sort by name
David דודו Markovitz
  • 42,900
  • 6
  • 64
  • 88

1 Answers1

1

I tried to get the node count of all the running Azure Kubernetes clusters in azure using the Azure Resource Graph Explorer by using the below query and got the results successfully as shown in the below image:

Resources
 | where type == "microsoft.containerservice/managedclusters"
 | extend properties.agentPoolProfiles
 | project subscriptionId, name, pool = (properties.agentPoolProfiles)
 | mv-expand pool
 | project subscription = subscriptionId, cluster = name, size = pool.vmSize, count = pool.['count']

enter image description here

If any of the Kubernetes service cluster is in stopped state then it's node count will be shown as "0" as shown in the below image:

enter image description here

RKM
  • 1,234
  • 1
  • 4
  • 9
  • Thanks for answering. I have tried your query, still it is giving the same result, I mean some cluster's nodepool has running nodes but node count is showing 0. Not sure where the problem is. – Subhajit Podder Sep 22 '22 at 15:52