Hosted solution to extract data per namespace in Azure AKS

8/24/2020

We have couple of clusters running in Azure using AKS service. In clusters we are running multiple projects, each one of them has different namespace, naturally.

I would like to extract data about number of pods, their status and conditions etc. for specific namespace. It is fairly easy to do locally using AZ CLI and installing kubectl (to get namespaces names) and then we can either stay in kubectl or use powershell Az.Aks module to extract these information.

I would like to have this process fully automated and scheduled. My first thought was Azure Runbook but it is not supporting AZ CLI.

What would be the best way to achieve what I have mentioned above? I believe the best way would be to use only kubectl commands, but how can we trigger them automatically? Is a pipeline in Azure Devops a solution?

Thanks, Rafal

-- Rafał Głębocki
azure
kubectl
kubernetes
monitoring

1 Answer

8/24/2020

You can use Azure Automation via RUnbooks, but just like Azure CLI you were trying you can do it through PowerShell. Runbooks can also be done using Python but for now only Python 2 is supported, and the same task can be done using Azure Functions but with so many different languages like C#, Java, Python and so many more.

Runbooks https://docs.microsoft.com/en-us/azure/automation/automation-runbook-types#:~:text=PowerShell%20Workflow%20runbooks%20are%20text,the%20runbook%20into%20Azure%20Automation.

Azure Functions https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-powershell

-- Hassan Raza
Source: StackOverflow