[zh] Tidy up and fix links in tasks section (2/10)

This commit is contained in:
Qiming Teng
2020-08-10 11:40:20 +08:00
parent 664464806c
commit 1281821884
14 changed files with 461 additions and 425 deletions
@@ -1,18 +1,9 @@
---
reviewers:
- bprashanth
- enisoc
- erictune
- foxish
- janetkuo
- kow3ns
- smarterclayton
title: 调试 Init 容器
content_type: task
---
<!--
---
reviewers:
- bprashanth
- enisoc
@@ -23,7 +14,6 @@ reviewers:
- smarterclayton
title: Debug Init Containers
content_type: task
---
-->
<!-- overview -->
@@ -34,15 +24,12 @@ 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>`.
-->
此页显示如何核查与 init 容器执行相关的问题。
下面的示例命令行将 Pod 称为 `<pod-name>`,而 init 容器称为 `<init-container-1>``<init-container-2>`
此页显示如何核查与 Init 容器执行相关的问题。
下面的示例命令行将 Pod 称为 `<pod-name>`,而 Init 容器称为 `<init-container-1>`
`<init-container-2>`
## {{% heading "prerequisites" %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
<!--
@@ -51,10 +38,8 @@ Init Containers. The example command lines below refer to the Pod as
* You should have [Configured an Init Container](/docs/tasks/configure-pod-container/configure-pod-initialization/#creating-a-pod-that-has-an-init-container/).
-->
* 应该熟悉 [Init 容器](/docs/concepts/abstractions/init-containers/)的基础知识。
* 应该已经[配置好一个 Init 容器](/docs/tasks/configure-pod-container/configure-pod-initialization/#creating-a-pod-that-has-an-init-container/)。
* 应该熟悉 [Init 容器](/zh/docs/concepts/workloads/pods/init-containers/)的基础知识。
* 应该已经[配置好一个 Init 容器](/zh/docs/tasks/configure-pod-container/configure-pod-initialization/#creating-a-pod-that-has-an-init-container/)。
<!-- steps -->
@@ -88,18 +73,14 @@ NAME READY STATUS RESTARTS AGE
See [Understanding Pod status](#understanding-pod-status) for more examples of
status values and their meanings.
-->
更多状态值及其含义请参考[了解 Pod 的状态](#understanding-pod-status)。
更多状态值及其含义请参考[理解 Pod 的状态](#understanding-pod-status)。
<!--
## Getting details about Init Containers
-->
## 获取 Init 容器详情
<!--
View more detailed information about Init Container execution:
-->
## 获取 Init 容器详情 {#getting-details-about-init-containers}
查看 Init 容器运行的更多详情:
@@ -110,8 +91,7 @@ kubectl describe pod <pod-name>
<!--
For example, a Pod with two Init Containers might show the following:
-->
例如,对于包含两个 Init 容器的 Pod 应该显示如下信息:
例如,对于包含两个 Init 容器的 Pod 可能显示如下信息:
```
Init Containers:
@@ -145,8 +125,7 @@ Init Containers:
You can also access the Init Container statuses programmatically by reading the
`status.initContainerStatuses` field on the Pod Spec:
-->
您还可以通过读取 Pod Spec 上的 `status.initContainerStatuses` 字段以编程方式了解 Init 容器的状态:
你还可以通过编程方式读取 Pod Spec 上的 `status.initContainerStatuses` 字段,了解 Init 容器的状态:
```shell
kubectl get pod nginx --template '{{.status.initContainerStatuses}}'
@@ -155,21 +134,17 @@ kubectl get pod nginx --template '{{.status.initContainerStatuses}}'
<!--
This command will return the same information as above in raw JSON.
-->
此命令将返回与原始 JSON 中相同的信息.
<!--
## Accessing logs from Init Containers
-->
## 通过 Init 容器访问日志
<!--
Pass the Init Container name along with the Pod name
to access its logs.
-->
## 通过 Init 容器访问日志 {#accessing-logs-from-init-containers}
一起传递 Init 容器名称与 Pod 名称来访问它的日志。
与 Pod 名称一起传递 Init 容器名称,以访问容器的日志。
```shell
kubectl logs <pod-name> -c <init-container-2>
@@ -180,25 +155,19 @@ Init Containers that run a shell script print
commands as they're executed. For example, you can do this in Bash by running
`set -x` at the beginning of the script.
-->
运行 shell 脚本打印命令的init容器,执行 shell 脚本
例如,您可以在 Bash 中通过在脚本的开头运行 `set -x` 来实现。
运行 Shell 脚本的 Init 容器在执行 Shell 脚本时输出命令本身。
例如,你可以在 Bash 中通过在脚本的开头运行 `set -x` 来实现
<!-- discussion -->
<!--
## Understanding Pod status
-->
## 了解 Pod 的状态
<!--
A Pod status beginning with `Init:` summarizes the status of Init Container
execution. The table below describes some example status values that you might
see while debugging Init Containers.
-->
## 理解 Pod 的状态 {#understanding-pod-status}
`Init:` 开头的 Pod 状态汇总了 Init 容器执行的状态。
下表介绍调试 Init 容器时可能看到的一些状态值示例。
@@ -213,13 +182,11 @@ Status | Meaning
`PodInitializing` or `Running` | The Pod has already finished executing Init Containers.
-->
状态 | 含义
状态 | 含义
------ | -------
`Init:N/M` | Pod 包含 `M` 个 Init 容器,其中 `N` 个已经运行完成。
`Init:Error` | Init 容器已执行失败。
`Init:CrashLoopBackOff` | Init 容器反复执行失败。
`Init:CrashLoopBackOff` | Init 容器执行总是失败。
`Pending` | Pod 还没有开始执行 Init 容器。
`PodInitializing` or `Running` | Pod 已经完成执行 Init 容器。