用于容器的 Azure Monitor 的部署和 HPA 指标Deployment & HPA metrics with Azure Monitor for containers

从代理版本 ciprod08072020 开始,集成了用于容器的 Azure Monitor 的代理现在可以收集部署和 HPA 指标。Starting with agent version ciprod08072020, Azure monitor for containers-integrated agent now collects metrics for Deployments & HPAs.

部署指标Deployment metrics

通过以 60 秒的间隔收集以下指标并将其存储在 InsightMetric 表中,用于容器的 Azure Monitor 会自动开始监视部署:Azure Monitor for containers automatically starts monitoring Deployments, by collecting the following metrics at 60 sec intervals and storing them in the InsightMetrics table:

指标名称Metric name 指标维度(标记)Metric dimension (tags) 说明Description
kube_deployment_status_replicas_readykube_deployment_status_replicas_ready container.azm.ms/clusterId, container.azm.ms/clusterName, creationTime, deployment, deploymentStrategy, k8sNamespace, spec_replicas, status_replicas_available, status_replicas_updated (status.updatedReplicas)container.azm.ms/clusterId, container.azm.ms/clusterName, creationTime, deployment, deploymentStrategy, k8sNamespace, spec_replicas, status_replicas_available, status_replicas_updated (status.updatedReplicas) 此部署所针对的就绪 Pod 总数 (status.readyReplicas)。Total number of ready pods targeted by this deployment (status.readyReplicas). 以下是此指标的维度。Below are dimensions of this metric.
  • 部署 - 部署的名称deployment - name of the deployment
  • k8sNamespace - 用于部署的 Kubernetes 命名空间k8sNamespace - Kubernetes namespace for the deployment
  • deploymentStrategy - 用于将 Pod 替换为新 Pod 的部署策略 (spec.strategy.type)deploymentStrategy - Deployment strategy to use to replace pods with new ones (spec.strategy.type)
  • creationTime - 部署创建时间戳creationTime - deployment creation timestamp
  • spec_replicas - 所需 Pod 数 (spec.replicas)spec_replicas - Number of desired pods (spec.replicas)
  • status_replicas_available - 此部署针对的可用 Pod 总数(准备至少 minReadySeconds)(status.availableReplicas)status_replicas_available - Total number of available pods (ready for at least minReadySeconds) targeted by this deployment (status.availableReplicas)
  • status_replicas_updated - 此部署针对的具有所需模板规范的未终止 Pod 的总数 (status.updatedReplicas)status_replicas_updated - Total number of non-terminated pods targeted by this deployment that have the desired template spec (status.updatedReplicas)

HPA 指标HPA metrics

通过以 60 秒的间隔收集以下指标并将其存储在 InsightMetric 表中,用于容器的 Azure Monitor 会自动开始监视 HPA:Azure Monitor for containers automatically starts monitoring HPAs, by collecting the following metrics at 60 sec intervals and storing them in the InsightMetrics table:

指标名称Metric name 指标维度(标记)Metric dimension (tags) 说明Description
kube_hpa_status_current_replicaskube_hpa_status_current_replicas container.azm.ms/clusterId, container.azm.ms/clusterName, creationTime, hpa, k8sNamespace, lastScaleTime, spec_max_replicas, spec_min_replicas, status_desired_replicas, targetKind, targetNamecontainer.azm.ms/clusterId, container.azm.ms/clusterName, creationTime, hpa, k8sNamespace, lastScaleTime, spec_max_replicas, spec_min_replicas, status_desired_replicas, targetKind, targetName 此自动缩放器管理的 Pod 的当前副本数 (status.currentReplicas)。Current number of replicas of pods managed by this autoscaler (status.currentReplicas). 以下是此指标的维度。Below are dimensions of this metric.
  • hpa - HPA 的名称hpa - name of the HPA
  • k8sNamespace - 用于 HPA 的 Kubernetes 命名空间k8sNamespace - Kubernetes namespace for the HPA
  • lastScaleTime - HPA 上一次扩展 Pod 数 (status.lastScaleTime)lastScaleTime - Last time the HPA scaled the number of pods (status.lastScaleTime)
  • creationTime - HPA 创建时间戳creationTime - HPA creation timestamp
  • spec_max_replicas - 自动缩放器可以设置的 Pod 数量上限 (spec.maxReplicas)spec_max_replicas - Upper limit for the number of pods that can be set by the autoscaler (spec.maxReplicas)
  • spec_min_replicas - 自动缩放器可以纵向缩减到的副本数的下限 (spec.minReplicas)spec_min_replicas - Lower limit for the number of replicas to which the autoscaler can scale down (spec.minReplicas)
  • status_desired_replicas - 此自动缩放器管理的所需 Pod 副本数 (status.desiredReplicas)status_desired_replicas - Desired number of replicas of pods managed by this autoscaler (status.desiredReplicas)
  • targetKind - HPA 的目标种类 (spec.scaleTargetRef.kind)targetKind - Kind of the HPA's target(spec.scaleTargetRef.kind)
  • targetName - HPA 的目标名称 (spec.scaleTargetRef.name)targetName - Name of the HPA's target (spec.scaleTargetRef.name)

部署和 HPA 图表Deployment & HPA charts

用于容器的 Azure Monitor 包含表中前面列出的指标的预配置图表,作为每个群集的工作簿。Azure Monitor for containers includes pre-configured charts for the metrics listed earlier in the table as a workbook for every cluster. 可以直接从 AKS 群集中找到部署和 HPA 工作簿“部署和 HPA”,方法是从左侧窗格中选择“工作簿”,然后从见解中的“查看工作簿”下拉列表中找到 。You can find the deployments & HPA workbook Deployments & HPA directly from an AKS cluster by selecting Workbooks from the left-hand pane, and from the View Workbooks drop-down list in the Insight.

后续步骤Next steps