【发布时间】:2019-04-15 10:55:29
【问题描述】:
我已向 Kubernetes 集群添加了几个 Horizontal Pod Autoscalers (HPA)。我想随着时间的推移监控每个 pod 的副本数。
StackDriver 是否可以选择监控每个 pod 随时间变化的副本数量?创建指标时,我找不到允许我执行此操作的选项。
【问题讨论】:
标签: kubernetes stackdriver google-cloud-monitoring
我已向 Kubernetes 集群添加了几个 Horizontal Pod Autoscalers (HPA)。我想随着时间的推移监控每个 pod 的副本数。
StackDriver 是否可以选择监控每个 pod 随时间变化的副本数量?创建指标时,我找不到允许我执行此操作的选项。
【问题讨论】:
标签: kubernetes stackdriver google-cloud-monitoring
我不认为你可以计算 pod,但你可以计算容器。通过复制的 Pod 中的容器数量恒定并进行适当的过滤,您将获得所需的内容。
在 Stackdriver 中,转到仪表板 -> 创建仪表板。选择以下设置:
Resource type: GKE Container
Metric: Uptime
Filter: (that's actually up to you, probably some label would work)
Group by: (use this if you want to have several lines on the chart at once)
Aggregator: count
这基本上是收集集群中容器的所有正常运行时间,通过您的标准过滤这些数据,并计算剩余的条目数。这为您提供了在给定时间启动的容器数量。当一个容器不存在时,它没有入口,所以入口的数量较少。
如果每个 pod 只有一个容器,那么就是这样。如果您有更多,只需将其考虑在内,然后将图表上的值除以每个 pod 的容器数。
【讨论】:
Requst cores 指标
与我上面的答案类似,但我使用了这个参数
Resource type: Kubernetes Container
Metric: Uptime
Filter: (that's actually up to you, probably some label would work)
Group by: (use this if you want to have several lines on the chart at once)
Aggregator: count
【讨论】: