我试图创建的AKS集群的一些具体数据的自定义仪表盘。我想要做的是组装的仪表板,每个选定的控制器和节点RAM和CPU使用的图表,并且如果可能的数目每荚的重启。如何创建与控制器的平均资源使用自定义的图表?
您可以点击在Azure的门户网站(左边上的AKS集群刀片“日志”链接确保您有通过点击“洞察”第一个启用的启示 - 如果它是好的,你会看到图表接近你想要什么,否则,你会看到入职的说明)。
使用以下查询以图表的CPU利用率(第95百分位),用于在给定的控制器的所有容器:
let endDateTime = now();
let startDateTime = ago(14d);
let trendBinSize = 1d;
let capacityCounterName = 'cpuLimitNanoCores';
let usageCounterName = 'cpuUsageNanoCores';
let clusterName = 'coin-test-i';
let controllerName = 'kube-svc-redirect';
KubePodInventory
| where TimeGenerated < endDateTime
| where TimeGenerated >= startDateTime
| where ClusterName == clusterName
| where ControllerName == controllerName
| extend InstanceName = strcat(ClusterId, '/', ContainerName),
ContainerName = strcat(controllerName, '/', tostring(split(ContainerName, '/')[1]))
| distinct Computer, InstanceName, ContainerName
| join hint.strategy=shuffle (
Perf
| where TimeGenerated < endDateTime
| where TimeGenerated >= startDateTime
| where ObjectName == 'K8SContainer'
| where CounterName == capacityCounterName
| summarize LimitValue = max(CounterValue) by Computer, InstanceName, bin(TimeGenerated, trendBinSize)
| project Computer, InstanceName, LimitStartTime = TimeGenerated, LimitEndTime = TimeGenerated + trendBinSize, LimitValue
) on Computer, InstanceName
| join kind=inner hint.strategy=shuffle (
Perf
| where TimeGenerated < endDateTime + trendBinSize
| where TimeGenerated >= startDateTime - trendBinSize
| where ObjectName == 'K8SContainer'
| where CounterName == usageCounterName
| project Computer, InstanceName, UsageValue = CounterValue, TimeGenerated
) on Computer, InstanceName
| where TimeGenerated >= LimitStartTime and TimeGenerated < LimitEndTime
| project Computer, ContainerName, TimeGenerated, UsagePercent = UsageValue * 100.0 / LimitValue
| summarize P95 = percentile(UsagePercent, 95) by bin(TimeGenerated, trendBinSize) , ContainerName
| render timechart
你想更换成群集名称和控制器名称。您还可以使用开始/结束时间参数,块大小,最大/最小/平均到位第95百分位的发挥。
对于内存的指标与替代指标名称:
let capacityCounterName = 'memoryLimitBytes';
let usageCounterName = 'memoryRssBytes';