-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ja-trans: tasks/debug-application-cluster/debug-init-containers/ #14488
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
117 changes: 117 additions & 0 deletions
117
content/ja/docs/tasks/debug-application-cluster/debug-init-containers.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
--- | ||
title: Init Containerのデバッグ | ||
content_template: templates/task | ||
--- | ||
|
||
{{% capture overview %}} | ||
|
||
このページでは、Init Containerの実行に関連する問題を調査する方法を説明します。以下のコマンドラインの例では、Podを`<pod-name>`、Init Containerを`<init-container-1>`および`<init-container-2>`として参照しています。 | ||
|
||
{{% /capture %}} | ||
|
||
{{% capture prerequisites %}} | ||
|
||
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}} | ||
|
||
* [Init Container](/docs/concepts/abstractions/init-containers/)の基本に精通しているべきです。 | ||
* [Init Containerを設定](/docs/tasks/configure-pod-container/configure-pod-initialization/#creating-a-pod-that-has-an-init-container/)しているべきです。 | ||
|
||
{{% /capture %}} | ||
|
||
{{% capture steps %}} | ||
|
||
## Init Containerのステータスを確認する | ||
|
||
Podのステータスを表示します: | ||
|
||
```shell | ||
kubectl get pod <pod-name> | ||
``` | ||
|
||
たとえば、`Init:1/2`というステータスは、2つのInit Containerのうちの1つが正常に完了したことを示します。 | ||
|
||
``` | ||
NAME READY STATUS RESTARTS AGE | ||
<pod-name> 0/1 Init:1/2 0 7s | ||
``` | ||
|
||
ステータス値とその意味の例については、[Podのステータスを理解する](#understanding-pod-status)を参照してください。 | ||
|
||
## Init Containerの詳細を取得する | ||
|
||
Init Containerの実行に関する詳細情報を表示します: | ||
|
||
```shell | ||
kubectl describe pod <pod-name> | ||
``` | ||
|
||
たとえば、2つのInit Containerを持つPodでは、次のように表示されます: | ||
|
||
``` | ||
Init Containers: | ||
<init-container-1>: | ||
Container ID: ... | ||
... | ||
State: Terminated | ||
Reason: Completed | ||
Exit Code: 0 | ||
Started: ... | ||
Finished: ... | ||
Ready: True | ||
Restart Count: 0 | ||
... | ||
<init-container-2>: | ||
Container ID: ... | ||
... | ||
State: Waiting | ||
Reason: CrashLoopBackOff | ||
Last State: Terminated | ||
Reason: Error | ||
Exit Code: 1 | ||
Started: ... | ||
Finished: ... | ||
Ready: False | ||
Restart Count: 3 | ||
... | ||
``` | ||
|
||
また、Pod Specの`status.initContainerStatuses`フィールドを読むことでプログラムでInit Containerのステータスにアクセスすることもできます。: | ||
|
||
|
||
```shell | ||
kubectl get pod nginx --template '{{.status.initContainerStatuses}}' | ||
``` | ||
|
||
|
||
このコマンドは生のJSONで上記と同じ情報を返します。 | ||
|
||
## Init Containerのログにアクセスする | ||
|
||
ログにアクセスするには、Init Container名とPod名を渡します。 | ||
|
||
```shell | ||
kubectl logs <pod-name> -c <init-container-2> | ||
``` | ||
|
||
シェルスクリプトを実行するInit Containerは、実行時にコマンドを出力します。たとえば、スクリプトの始めに`set -x`を実行することでBashで同じことができます。 | ||
|
||
{{% /capture %}} | ||
|
||
{{% capture discussion %}} | ||
|
||
## Podのステータスを理解する | ||
|
||
`Init:`で始まるPodステータスはInit Containerの実行ステータスを要約します。以下の表は、Init Containerのデバッグ中に表示される可能性のあるステータス値の例をいくつか示しています。 | ||
|
||
ステータス | 意味 | ||
------ | ------- | ||
`Init:N/M` | Podは`M`個のInit Containerを持ち、これまでに`N`個完了しました。 | ||
`Init:Error` | Init Containerが実行に失敗しました。 | ||
`Init:CrashLoopBackOff` | Init Containerが繰り返し失敗しました。 | ||
`Pending` | PodはまだInit Containerの実行を開始していません。 | ||
`PodInitializing` or `Running` | PodはすでにInit Containerの実行を終了しています。 | ||
|
||
{{% /capture %}} | ||
|
||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
べき、は不自然なので、
とかどうでしょう。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldの訳は悩んだところです。「しておきましょう」よいですね。修正します。ありがとうございます。