簡體   English   中英

是否可以使用 StackDriver 隨時間監控 Kubernetes 集群中的 Pod 副本數量?

[英]Is it possible to monitor the number of pod-replicas in a Kubernetes cluster over time with StackDriver?

我在 Kubernetes 集群中添加了幾個 Horizontal Pod Autoscalers (HPA)。 我想隨着時間的推移監視每個 pod 的副本數。

StackDriver是否可以選擇隨時間監控每個 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 的容器數量。

示例配置

類似於我上面的答案,但我使用了這個參數

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM