File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
content/ja/docs/concepts/cluster-administration Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ title : Kubernetesオブジェクトの状態メトリクス
3
+ content_type : concept
4
+ weight : 75
5
+ description : >-
6
+ クラスターレベルのメトリクスを生成・公開するアドオンエージェント、kube-state-metrics。
7
+ ---
8
+
9
+ Kubernetes API内のKubernetesオブジェクトの状態は、メトリクスとして公開することができます。
10
+ [ kube-state-metrics] ( https://github.com/kubernetes/kube-state-metrics ) と呼ばれるアドオンエージェントは、Kubernetes APIサーバーに接続し、クラスター内の個別オブジェクトの状態から生成されたメトリクスを含むHTTPエンドポイントを公開します。
11
+ このエージェントは、ラベルやアノテーション、起動・終了時刻、ステータス、またはオブジェクトが現在置かれているフェーズなど、オブジェクトの状態に関する様々な情報を公開します。
12
+ 例えば、Pod内で実行されているコンテナは` kube_pod_container_info ` メトリクスを作成します。
13
+ このメトリクスには、コンテナ名、それが属するPod名、Podが実行されている{{< glossary_tooltip text="ネームスペース" term_id="namespace" >}}、コンテナイメージ名、イメージID、コンテナspecからのイメージ名、実行中のコンテナID、およびPod IDがラベルとして含まれています。
14
+
15
+ {{% thirdparty-content single="true" %}}
16
+
17
+ kube-state-metricsのエンドポイントをスクレイプすることができる外部コンポーネント(例えば、Prometheusなど)を使用することで、以下のユースケースを実現できます。
18
+
19
+ ## 例: kube-state-metricsのメトリクスを使用したクラスター状態のクエリ {#example-kube-state-metrics-query-1}
20
+
21
+ kube-state-metricsによって生成されるメトリクス系列は、クエリに使用できるため、クラスターに関する更なる洞察を得るのに役立ちます。
22
+
23
+ Prometheusまたは同じクエリ言語を使用する他のツールを使用している場合、以下のPromQLクエリは準備完了していないPodの数を返します:
24
+
25
+ ```
26
+ count(kube_pod_status_ready{condition="false"}) by (namespace, pod)
27
+ ```
28
+
29
+ ## 例: kube-state-metricsに基づくアラート {#example-kube-state-metrics-alert-1}
30
+
31
+ kube-state-metricsから生成されるメトリクスを使用することで、クラスター内の問題に対するアラートも可能になります。
32
+
33
+ Prometheusまたは同じアラートルール言語を使用する類似のツールを使用している場合、以下のアラートは5分以上` Terminating ` 状態にあるPodが存在する際に発火します:
34
+
35
+ ``` yaml
36
+ groups :
37
+ - name : Pod state
38
+ rules :
39
+ - alert : PodsBlockedInTerminatingState
40
+ expr : count(kube_pod_deletion_timestamp) by (namespace, pod) * count(kube_pod_status_reason{reason="NodeLost"} == 0) by (namespace, pod) > 0
41
+ for : 5m
42
+ labels :
43
+ severity : page
44
+ annotations :
45
+ summary : Pod {{$labels.namespace}}/{{$labels.pod}} blocked in Terminating state.
46
+ ` ` `
You can’t perform that action at this time.
0 commit comments