* 'master' of https://github.com/kubernetes/kubernetes.github.io:
  Edits for clarity, concision, style, formatting, (#4160)
reviewable/pr4173/r1
Andrew Chen 2017-06-22 15:43:48 -07:00
commit 5bd740ef7e
1 changed files with 14 additions and 15 deletions

View File

@ -16,18 +16,19 @@ redirect_from:
{% capture overview %} {% capture overview %}
This page shows how to investigate problems related to the execution of This page shows how to investigate problems related to the execution of
Init Containers. Init Containers. The example command lines below refer to the Pod as
`<pod-name>` and the Init Containers as `<init-container-1>` and
`<init-container-2>`.
{% endcapture %} {% endcapture %}
{% capture prerequisites %} {% capture prerequisites %}
{% include task-tutorial-prereqs.md %}
* You should be familiar with the basics of * You should be familiar with the basics of
[Init Containers](/docs/concepts/abstractions/init-containers/). [Init Containers](/docs/concepts/abstractions/init-containers/).
* You should have a [Pod](/docs/concepts/workloads/pods/pod/) you want to debug that uses * You should have [Configured an Init Container](/docs/tasks/configure-pod-container/configure-pod-initialization/#creating-a-pod-that-has-an-init-container/).
Init Containers. The example command lines below refer to the Pod as
`<pod-name>` and the Init Containers as `<init-container-1>` and
`<init-container-2>`.
{% endcapture %} {% endcapture %}
@ -35,7 +36,7 @@ Init Containers.
## Checking the status of Init Containers ## Checking the status of Init Containers
The Pod status will give you an overview of Init Container execution: Display the status of your pod:
```shell ```shell
kubectl get pod <pod-name> kubectl get pod <pod-name>
@ -54,7 +55,7 @@ status values and their meanings.
## Getting details about Init Containers ## Getting details about Init Containers
You can see detailed information about Init Container execution by running: View more detailed information about Init Container execution:
```shell ```shell
kubectl describe pod <pod-name> kubectl describe pod <pod-name>
@ -99,18 +100,18 @@ kubectl get pod nginx --template '{{.status.initContainerStatuses}}'
``` ```
{% endraw %} {% endraw %}
This will return the same information as above, but in raw JSON format. This command will return the same information as above in raw JSON.
## Accessing logs from Init Containers ## Accessing logs from Init Containers
You can access logs for an Init Container by passing its Container name along Pass the Init Container name along with the Pod name
with the Pod name: to access its logs.
```shell ```shell
kubectl logs <pod-name> -c <init-container-2> kubectl logs <pod-name> -c <init-container-2>
``` ```
If your Init Container runs a shell script, it helps to enable printing of Init Containers that run a shell script print
commands as they're executed. For example, you can do this in Bash by running commands as they're executed. For example, you can do this in Bash by running
`set -x` at the beginning of the script. `set -x` at the beginning of the script.
@ -129,10 +130,8 @@ Status | Meaning
`Init:N/M` | The Pod has `M` Init Containers, and `N` have completed so far. `Init:N/M` | The Pod has `M` Init Containers, and `N` have completed so far.
`Init:Error` | An Init Container has failed to execute. `Init:Error` | An Init Container has failed to execute.
`Init:CrashLoopBackOff` | An Init Container has failed repeatedly. `Init:CrashLoopBackOff` | An Init Container has failed repeatedly.
`Pending` | The Pod has not yet begun executing Init Containers.
A Pod with status `Pending` has not yet begun executing Init Containers. `PodInitializing` or `Running` | The Pod has already finished executing Init Containers.
A Pod with status `PodInitializing` or `Running` has already finished executing
Init Containers.
{% endcapture %} {% endcapture %}