0

I have 3 AKS Clusters in my Azure, and I need to list all namespaces belonging to each specific AKS cluster using a resource graph query. Is it possible? If so, could you please support me to write this query since I couldn't find a way on the web to be able to retrieve this output using resource graph.

Any feedback, help is greatly appreciated.

Have a nice day.

vcb0127
  • 11
  • 1
  • A namespace in something knows to AKS as part of kubernetes. It is not an azure managed resource so you won't be able to query it using the resource graph. Like you also cannot query what tables live inside a Sql Database because it is part of sql and not an azure resource. – Peter Bons Aug 28 '23 at 08:24
  • Its not possible through Azure Resource Graph but you can get the same information using Log Analytics workspace. – Venkat V Aug 28 '23 at 11:16
  • How can I get it using Log Analytics workspace? Is there any source or further instructions from your point of view to handle this task? – vcb0127 Aug 28 '23 at 14:09

1 Answers1

0

Listing all namespaces belonging to specific AKS clusters using Log Analytics workspace.

To list all namespaces belonging to each specific AKS cluster using the Log Analytics workspace, follow the steps below.

  1. Create a Log Analytics workspace

enter image description here

  1. Link your AKS clusters to the Log Analytics workspace by following the steps below.

Go to AKS Cluster > Diagnostic settings > Add diagnostic setting > Save

enter image description here

  1. Go to the Log Analytics workspace, select logs, and then run the below KQL query

enter image description here

Venkat V
  • 2,197
  • 1
  • 1
  • 10
  • Thank you very much! You made my day. However, one more question regarding to include all of the AKS clusters in this query. If we would like to have all of namespaces belonging to each those 3 AKS clusters, should we follow the same steps like: 1) creating diagnostic setting, and integrating them with the existing Log Analytics Workspace. 2) Then in the first line of the query something like -> | where ClusterName in ('firstClusterName', 'secondClusterName', 'thirdClusterName') – vcb0127 Aug 30 '23 at 12:50
  • Yes, follow the same steps. – Venkat V Aug 30 '23 at 12:53