azure - KQL 查询以获取在 azure 中运行的 Aks 集群的节点数

标签 azure azure-aks kql azure-resource-graph

我是 Kusto 的新手。我需要一个查询来获取所有正在运行的 Azure kubernetes 集群的当前节点数。我已经尝试过下面的方法,但对于少数集群,它给出的节点数为 0,其中模式存在于这些集群上

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

最佳答案

我尝试使用以下查询使用 Azure Resource Graph Explorer 获取 azure 中所有正在运行的 Azure Kubernetes 集群的节点数,并成功获得结果,如下图所示:

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

如果任何 Kubernetes 服务集群处于停止状态,则其节点数将显示为“0”,如下图所示:

enter image description here

关于azure - KQL 查询以获取在 azure 中运行的 Aks 集群的节点数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73804538/

相关文章:

基于 Azure Kubernetes token 的 ML Web 服务身份验证

azure-devops - 使用 AzureDevops 在 Azure Kubernetes 服务 (AKS) 中部署容器镜像

azure - 没有使用 ARM 模板通过 Azure 容器注册表 (ACR) 创建 Azure AKS 群集的选项

azure - 需要从 Azure App Insights 查找每个 API 调用的峰值使用情况

azure - 在 Log Analytics 中使用共享的用户定义的 Kusto 函数

azure - 如何根据自定义图表中的azure仪表板中的选定时间段计算时间粒度

azure - 微软认知服务语音转文本的客户计费/客户使用情况?

azure - 无法连接到 Azure Active Directory 安全 Ldap

azure - 如何使用自动化帐户 PowerShell Runbook 重置 Azure 服务主体的凭据?

node.js - 如何使用 Azure AD 实现身份验证和授权 Nodejs Azure Functions 应用程序