Skip to content

Commit 292eda0

Browse files
authored
[ja]Translate content/en/docs/platforms/kubernetes/operator/horizonta… (#7161)
1 parent bc45f58 commit 292eda0

File tree

1 file changed

+136
-0
lines changed

1 file changed

+136
-0
lines changed
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
title: 水平Pod自動スケーリング
3+
description: OpenTelemetryコレクターの水平Pod自動スケーリングを設定する
4+
default_lang_commit: c392c714849921cd56aca8ca99ab11e0e4cb16f4
5+
cSpell:ignore: autoscaler statefulset
6+
---
7+
8+
OpenTelemetryオペレーターによって管理されるコレクターは、[水平Pod自動スケーリング(HPA)](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/)をビルトインでサポートしています。
9+
HPAは、一連のメトリクスに基づいて、KubernetesのPodのレプリカ(コピー)の数を増減させます。
10+
これらのメトリクスは通常、CPUやメモリの使用量です。
11+
OpenTelemetryオペレーターがコレクターのHPA機能を管理することで、コレクターの自動スケーリングのために別のKubernetes `HorizontalPodAutoscaler` リソースを作成する必要がなくなります。
12+
13+
HPAはKubernetesの `StatefulSet``Deployment` にのみ適用されるため、コレクターの `spec.mode``deployment` または `statefulset` のいずれかであることを確認してください。
14+
15+
{{% alert title="Note" %}}
16+
HPAは、Kubernetesクラスターで実行されている[Metrics Server](https://github.com/kubernetes-sigs/metrics-server)を必要とします。
17+
18+
- [GKE (Google)](https://cloud.google.com/kubernetes-engine?hl=en)[AKS (Microsoft Azure)](https://azure.microsoft.com/en-us/products/kubernetes-service)などのマネージドKubernetesクラスターは、クラスターのプロビジョニングの一環としてMetrics Serverを自動的にインストールします。
19+
- [EKS (AWS)にはデフォルトでMetrics Serverはインストールされていません](https://docs.aws.amazon.com/eks/latest/userguide/metrics-server.html)
20+
- マネージドでないKuberentesクラスターやローカルデスクトップのKubernetesクラスター(たとえば[MiniKube](https://minikube.sigs.k8s.io/docs/)
21+
[KinD](https://kind.sigs.k8s.io/)[k0s](https://k0sproject.io))では、Metrics Serverを手動でインストールする必要があります。
22+
23+
管理するKubernetesクラスターにMetrics Serverが事前にインストールされているかどうかを確認するには、クラウドプロバイダーのドキュメントを参照してください。
24+
{{% /alert %}}
25+
26+
HPAを構成するには、まず `OpenTelemetryCollector` のYAMLに `spec.resources` 設定を追加して、リソースの要求と制限を定義する必要があります。
27+
28+
```yaml
29+
resources:
30+
limits:
31+
cpu: 100m
32+
memory: 128Mi
33+
requests:
34+
cpu: 100m
35+
memory: 64Mi
36+
```
37+
38+
{{% alert title="Note" %}} あなた自身の価値観は異なるかもしれません。 {{% /alert %}}
39+
40+
`limits` 設定には、メモリとCPUの最大値が指定されます。
41+
このケースでは、これらの制限はCPUの100ミリコア(0.1コア)とRAMの128Mi(メビバイト、1メビバイト == 1024キロバイト)です。
42+
43+
`requests` 設定には、コンテナに割り当てが保証されるリソースの最小量が指定されます。
44+
このケースでは、最小の割り当ては、100ミリコアのCPUと64メビバイトのRAMです。
45+
46+
次に、`OpenTelemetryCollector` のYAMLに `spec.autoscaler` 設定を追加して、自動スケーリングルールを構成します。
47+
48+
```yaml
49+
autoscaler:
50+
minReplicas: 1
51+
maxReplicas: 2
52+
targetCPUUtilization: 50
53+
targetMemoryUtilization: 60
54+
```
55+
56+
{{% alert title="Note" %}} あなた自身の価値観は異なるかもしれません。 {{% /alert %}}
57+
58+
すべてをまとめると、`OpenTelemetryCollector` のYAMLの始まりは次のようになります。
59+
60+
```yaml
61+
apiVersion: opentelemetry.io/v1beta1
62+
kind: OpenTelemetryCollector
63+
metadata:
64+
name: otelcol
65+
namespace: opentelemetry
66+
spec:
67+
mode: statefulset
68+
image: otel/opentelemetry-collector-contrib:{{% version-from-registry
69+
collector-processor-batch %}}
70+
serviceAccount: otelcontribcol
71+
autoscaler:
72+
minReplicas: 1
73+
maxReplicas: 2
74+
targetCPUUtilization: 50
75+
targetMemoryUtilization: 60
76+
resources:
77+
limits:
78+
cpu: 100m
79+
memory: 128Mi
80+
requests:
81+
cpu: 100m
82+
memory: 64Mi
83+
```
84+
85+
HPAを有効にして `OpenTelemetryCollector` をKubernetesにデプロイすると、オペレーターはKubernetes内のコレクター用に `HorizontalPodAutoscaler` リソースを作成します。
86+
これを確認するには、次のコマンドを実行します。
87+
88+
`kubectl get hpa -n <your_namespace>`
89+
90+
すべてが期待通りに動作した場合、コマンドの出力は次のようになります。
91+
92+
```nocode
93+
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
94+
otelcol-collector OpenTelemetryCollector/otelcol memory: 68%/60%, cpu: 37%/50% 1 3 2 77s
95+
```
96+
97+
より詳細な情報を得るには、次のコマンドを実行してHPAリソースの説明を取得できます。
98+
99+
`kubectl describe hpa <your_collector_name> -n <your_namespace>`
100+
101+
すべてが期待通りに動作した場合、コマンドの出力は次のようになります。
102+
103+
```nocode
104+
Name: otelcol-collector
105+
Namespace: opentelemetry
106+
Labels: app.kubernetes.io/benchmark-test=otelcol-contrib
107+
app.kubernetes.io/component=opentelemetry-collector
108+
app.kubernetes.io/destination=dynatrace
109+
app.kubernetes.io/instance=opentelemetry.otelcol
110+
app.kubernetes.io/managed-by=opentelemetry-operator
111+
app.kubernetes.io/name=otelcol-collector
112+
app.kubernetes.io/part-of=opentelemetry
113+
app.kubernetes.io/version=0.126.0
114+
Annotations: <none>
115+
CreationTimestamp: Mon, 02 Jun 2025 17:23:52 +0000
116+
Reference: OpenTelemetryCollector/otelcol
117+
Metrics: ( current / target )
118+
resource memory on pods (as a percentage of request): 71% (95779498666m) / 60%
119+
resource cpu on pods (as a percentage of request): 12% (12m) / 50%
120+
Min replicas: 1
121+
Max replicas: 3
122+
OpenTelemetryCollector pods: 3 current / 3 desired
123+
Conditions:
124+
Type Status Reason Message
125+
---- ------ ------ -------
126+
AbleToScale True ReadyForNewScale recommended size matches current size
127+
ScalingActive True ValidMetricFound the HPA was able to successfully calculate a replica count from memory resource utilization (percentage of request)
128+
ScalingLimited True TooManyReplicas the desired replica count is more than the maximum replica count
129+
Events:
130+
Type Reason Age From Message
131+
---- ------ ---- ---- -------
132+
Warning FailedGetResourceMetric 2m (x4 over 2m29s) horizontal-pod-autoscaler unable to get metric memory: no metrics returned from resource metrics API
133+
Warning FailedGetResourceMetric 89s (x7 over 2m29s) horizontal-pod-autoscaler No recommendation
134+
Normal SuccessfulRescale 89s horizontal-pod-autoscaler New size: 2; reason: memory resource utilization (percentage of request) above target
135+
Normal SuccessfulRescale 59s horizontal-pod-autoscaler New size: 3; reason: memory resource utilization (percentage of request) above target
136+
```

0 commit comments

Comments
 (0)