Skip to content

Commit 8fae4da

Browse files
authored
[ja] Translate content/en/docs/tasks/manage-daemon/create-daemon-set.md (kubernetes#49856)
* translate create-daemon-set.md into Japanese * Update content titles * incorporated review feedback * incorporated review feedback
1 parent 6bba8cb commit 8fae4da

File tree

3 files changed

+106
-0
lines changed

3 files changed

+106
-0
lines changed

Diff for: content/ja/docs/tasks/manage-daemon/_index.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "クラスターデーモンの管理"
3+
description: ローリングアップデートの実行など、DaemonSetを管理するための一般的なタスクを実行します。
4+
weight: 130
5+
---
6+
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: 基本的なDaemonSetを構築する
3+
content_type: task
4+
weight: 5
5+
---
6+
<!-- overview -->
7+
8+
このページでは、Kubernetesクラスターの全てのノード上でPodを実行する、基本的な{{< glossary_tooltip text="DaemonSet" term_id="daemonset" >}}を構築する方法について示します。
9+
ホストからファイルをマウントし、[Initコンテナ](/ja/docs/concepts/workloads/pods/init-containers/)を使用してその内容をログに記録して、pauseコンテナを利用するという単純なユースケースを取り上げます。
10+
11+
## {{% heading "prerequisites" %}}
12+
13+
{{< include "task-tutorial-prereqs.md" >}}
14+
15+
DaemonSetの動作を示すために、少なくとも2つのノード(1つのコントロールプレーンと1つのワーカーノード)を持つKubernetesクラスターを用意します。
16+
17+
## DaemonSetの定義
18+
19+
このタスクでは、Podのコピーが全てのノード上でスケジュールされるようにする、基本的なDaemonSetが作成されます。
20+
PodはInitコンテナを使用してホストから`/etc/machine-id`の内容を読み込んでログに記録し、メインのコンテナはPodを実行し続ける`pause`コンテナとなります。
21+
22+
{{% code_sample file="application/basic-daemonset.yaml" %}}
23+
24+
1. (YAML)マニフェストに基づいたDaemonSetを作成します:
25+
26+
```shell
27+
kubectl apply -f https://k8s.io/examples/application/basic-daemonset.yaml
28+
```
29+
30+
1. 適用すると、DaemonSetがクラスター内の全てのノードでPodを実行していることを確認できます:
31+
32+
```shell
33+
kubectl get pods -o wide
34+
```
35+
36+
出力には、以下のようにノード毎に1つのPodが一覧表示されます:
37+
38+
```
39+
NAME READY STATUS RESTARTS AGE IP NODE
40+
example-daemonset-xxxxx 1/1 Running 0 5m x.x.x.x node-1
41+
example-daemonset-yyyyy 1/1 Running 0 5m x.x.x.x node-2
42+
```
43+
44+
1. ホストからマウントされたログディレクトリをチェックすることで、ログに記録された`/etc/machine-id`ファイルの内容を調べることができます:
45+
46+
```shell
47+
kubectl exec <pod-name> -- cat /var/log/machine-id.log
48+
```
49+
50+
`<pod-name>`は1つのPodの名前です。
51+
52+
## {{% heading "cleanup" %}}
53+
54+
DaemonSetを削除するためには、次のコマンドを実行します:
55+
56+
```shell
57+
kubectl delete --cascade=foreground --ignore-not-found --now daemonsets/example-daemonset
58+
```
59+
60+
この単純なDaemonSetの例では、Initコンテナやホストパスボリュームなどの主要なコンポーネントを紹介しており、より高度なユースケースに応じて拡張することができます。
61+
詳細については[DaemonSet](/ja/docs/concepts/workloads/controllers/daemonset/)を参照してください。
62+
63+
## {{% heading "whatsnext" %}}
64+
65+
* [DaemonSet上でローリングアップデートを実施する](/docs/tasks/manage-daemon/update-daemon-set/)を参照
66+
* [既存のDaemonSetのPodを再利用してDaemonSetを作成する](/ja/docs/concepts/workloads/controllers/daemonset/)を参照

Diff for: content/ja/examples/application/basic-daemonset.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: example-daemonset
5+
spec:
6+
selector:
7+
matchLabels:
8+
app.kubernetes.io/name: example
9+
template:
10+
metadata:
11+
labels:
12+
app.kubernetes.io/name: example
13+
spec:
14+
containers:
15+
- name: pause
16+
image: registry.k8s.io/pause
17+
initContainers:
18+
- name: log-machine-id
19+
image: busybox:1.37
20+
command: ['sh', '-c', 'cat /etc/machine-id > /var/log/machine-id.log']
21+
volumeMounts:
22+
- name: machine-id
23+
mountPath: /etc/machine-id
24+
readOnly: true
25+
- name: log-dir
26+
mountPath: /var/log
27+
volumes:
28+
- name: machine-id
29+
hostPath:
30+
path: /etc/machine-id
31+
type: File
32+
- name: log-dir
33+
hostPath:
34+
path: /var/log

0 commit comments

Comments
 (0)