Skip to content

Commit c4d72bd

Browse files
authored
Merge pull request #50367 from levi106/rollback-daemon-set
[ja] Translate content/en/docs/tasks/manage-daemon/rollback-daemon-set.md
2 parents 82660c8 + c16b900 commit c4d72bd

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: DaemonSet上でロールバックを実施する
3+
content_type: task
4+
weight: 20
5+
min-kubernetes-server-version: 1.7
6+
---
7+
8+
<!-- overview -->
9+
10+
このページでは、{{< glossary_tooltip term_id="daemonset" >}}上でロールバックを行う方法について説明します。
11+
12+
13+
## {{% heading "prerequisites" %}}
14+
15+
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
16+
17+
[DaemonSet上でローリングアップデートを実施する](/ja/docs/tasks/manage-daemon/update-daemon-set/)方法については既に知っているものとします。
18+
19+
<!-- steps -->
20+
21+
## DaemonSet上のロールバックの実施
22+
23+
### ステップ1: ロールバック先のDaemonSetのリビジョンを見つける
24+
25+
最新のリビジョンにロールバックしたい場合は、このステップを省略できます。
26+
27+
DaemonSetの全てのリビジョンを列挙します:
28+
29+
```shell
30+
kubectl rollout history daemonset <daemonset-name>
31+
```
32+
33+
これはDaemonSetのリビジョンのリストを返します:
34+
35+
```
36+
daemonsets "<daemonset-name>"
37+
REVISION CHANGE-CAUSE
38+
1 ...
39+
2 ...
40+
...
41+
```
42+
43+
* 変更理由は作成時にDaemonSetのアノテーション`kubernetes.io/change-cause`からコピーされます。
44+
実行したコマンドをchange-causeアノテーションに記録するために、`kubectl`内で`--record=true`を指定することができます。
45+
46+
特定のリビジョンの詳細を見るためには次を実行します:
47+
48+
```shell
49+
kubectl rollout history daemonset <daemonset-name> --revision=1
50+
```
51+
52+
これは、そのリビジョンの詳細を返します:
53+
54+
```
55+
daemonsets "<daemonset-name>" with revision #1
56+
Pod Template:
57+
Labels: foo=bar
58+
Containers:
59+
app:
60+
Image: ...
61+
Port: ...
62+
Environment: ...
63+
Mounts: ...
64+
Volumes: ...
65+
```
66+
67+
### ステップ2: 特定のリビジョンにロールバックする
68+
69+
```shell
70+
# ステップ1で得たリビジョン番号を--to-revisionで指定します。
71+
kubectl rollout undo daemonset <daemonset-name> --to-revision=<revision>
72+
```
73+
74+
成功すると、コマンドは次を返します:
75+
76+
```
77+
daemonset "<daemonset-name>" rolled back
78+
```
79+
80+
{{< note >}}
81+
`--to-revision`フラグが指定されない場合は、kubectlは最新のリビジョンを取得します。
82+
{{< /note >}}
83+
84+
### ステップ3: DaemonSetのロールバックの進行状況を監視する
85+
86+
`kubectl rollout undo daemonset`は、サーバーに対してDaemonSetのロールバックを開始するよう指示します。
87+
実際のロールバックはクラスターの{{< glossary_tooltip term_id="control-plane" text="コントロールプレーン" >}}内で非同期に実行されます。
88+
89+
ロールバックの進行状況を監視するためには次を実行します:
90+
91+
```shell
92+
kubectl rollout status ds/<daemonset-name>
93+
```
94+
95+
ロールバックが完了すると、次のような出力が得られます:
96+
97+
```
98+
daemonset "<daemonset-name>" successfully rolled out
99+
```
100+
101+
102+
<!-- discussion -->
103+
104+
## DaemonSetのリビジョンを理解する
105+
106+
前の`kubectl rollout history`のステップでは、DaemonSetのリビジョンのリストを取得しました。
107+
各リビジョンは、ControllerRevisionという名前のリソースに格納されています。
108+
109+
各リビジョンに何が格納されているか確認するためには、DaemonSetのリビジョンの生のリソースを探します:
110+
111+
```shell
112+
kubectl get controllerrevision -l <daemonset-selector-key>=<daemonset-selector-value>
113+
```
114+
115+
これはControllerRevisionsのリストを返します:
116+
117+
```
118+
NAME CONTROLLER REVISION AGE
119+
<daemonset-name>-<revision-hash> DaemonSet/<daemonset-name> 1 1h
120+
<daemonset-name>-<revision-hash> DaemonSet/<daemonset-name> 2 1h
121+
```
122+
123+
各ControllerRevisionはアノテーションとDaemonSetのリビジョンのテンプレートを格納します。
124+
125+
`kubectl rollout undo`は特定のControllerRevisionを受け取り、DaemonSetのテンプレートを、ControllerRevision内に保管されたテンプレートに置き換えます。
126+
`kubectl rollout undo`はDaemonSetのテンプレートを、`kubectl edit``kubectl apply`のような他のコマンドによって、以前のリビジョンに更新することに相当します。
127+
128+
{{< note >}}
129+
DaemonSetのリビジョンはロールフォワードのみとなります。
130+
これはつまり、ロールバックが完了すると、ControllerRevisionのリビジョン番号(`.revision`フィールド)が繰り上がります。
131+
例えば、システムにリビジョン1と2があってリビジョン2からリビジョン1にロールバックすると、`.revision: 1`のControllerRevisionは`.revision: 3`になります。
132+
{{< /note >}}
133+
134+
## トラブルシューティング
135+
136+
* [DaemonSetのローリングアップデートのトラブルシューティング](/ja/docs/tasks/manage-daemon/update-daemon-set/#troubleshooting)を参照。

0 commit comments

Comments
 (0)