Merge pull request #35951 from yanrongshi/zh-cn]Sync-init-containers.md
[zh-cn]Sync update some doc formatpull/36749/head
commit
70f6fa83c7
|
@ -16,8 +16,8 @@ no_list: true
|
|||
|
||||
<!--
|
||||
Whether your workload is a single component or several that work together, on Kubernetes you run
|
||||
it inside a set of [Pods](/docs/concepts/workloads/pods).
|
||||
In Kubernetes, a Pod represents a set of running
|
||||
it inside a set of [_pods_](/docs/concepts/workloads/pods).
|
||||
In Kubernetes, a `Pod` represents a set of running
|
||||
{{< glossary_tooltip text="containers" term_id="container" >}} on your cluster.
|
||||
|
||||
A Pod has a defined lifecycle. For example, once a Pod is running in your cluster then
|
||||
|
@ -26,8 +26,8 @@ Pod is running means that all the Pods on that node fail. Kubernetes treats that
|
|||
of failure as final: you would need to create a new Pod even if the node later recovers.
|
||||
-->
|
||||
在 Kubernetes 中,无论你的负载是由单个组件还是由多个一同工作的组件构成,
|
||||
你都可以在一组 [Pod](/zh-cn/docs/concepts/workloads/pods) 中运行它。
|
||||
在 Kubernetes 中,Pod 代表的是集群上处于运行状态的一组
|
||||
你都可以在一组 [**Pod**](/zh-cn/docs/concepts/workloads/pods) 中运行它。
|
||||
在 Kubernetes 中,`Pod` 代表的是集群上处于运行状态的一组
|
||||
{{< glossary_tooltip text="容器" term_id="container" >}} 的集合。
|
||||
|
||||
<!--
|
||||
|
@ -44,15 +44,15 @@ Kubernetes Pods 遵循[预定义的生命周期](/zh-cn/docs/concepts/workloads/
|
|||
即使该节点后来恢复正常运行,你也需要创建新的 Pod 以恢复应用。
|
||||
|
||||
<!--
|
||||
However, to make life considerably easier, you don't need to manage each Pod directly.
|
||||
Instead, you can use _workload resources_ that manage a set of Pods on your behalf.
|
||||
However, to make life considerably easier, you don't need to manage each `Pod` directly.
|
||||
Instead, you can use _workload resources_ that manage a set of pods on your behalf.
|
||||
These resources configure {{< glossary_tooltip term_id="controller" text="controllers" >}}
|
||||
that make sure the right number of the right kind of Pod are running, to match the state
|
||||
that make sure the right number of the right kind of pod are running, to match the state
|
||||
you specified.
|
||||
|
||||
Kubernetes provides several built-in workload resources:
|
||||
-->
|
||||
不过,为了减轻用户的使用负担,通常不需要用户直接管理每个 Pod。
|
||||
不过,为了减轻用户的使用负担,通常不需要用户直接管理每个 `Pod`。
|
||||
而是使用**负载资源**来替用户管理一组 Pod。
|
||||
这些负载资源通过配置 {{< glossary_tooltip term_id="controller" text="控制器" >}}
|
||||
来确保正确类型的、处于运行状态的 Pod 个数是正确的,与用户所指定的状态相一致。
|
||||
|
@ -60,7 +60,7 @@ Kubernetes provides several built-in workload resources:
|
|||
Kubernetes 提供若干种内置的工作负载资源:
|
||||
|
||||
<!--
|
||||
* [Deployment](/docs/concepts/workloads/controllers/deployment/) and [ReplicaSet](/docs/concepts/workloads/controllers/replicaset/)
|
||||
* [`Deployment`](/docs/concepts/workloads/controllers/deployment/) and [`ReplicaSet`](/docs/concepts/workloads/controllers/replicaset/)
|
||||
(replacing the legacy resource
|
||||
{{< glossary_tooltip text="ReplicationController" term_id="replication-controller" >}}).
|
||||
`Deployment` is a good fit for managing a stateless application workload on your cluster,
|
||||
|
@ -72,8 +72,8 @@ Kubernetes 提供若干种内置的工作负载资源:
|
|||
`Pods` for that `StatefulSet`, can replicate data to other `Pods` in the same `StatefulSet`
|
||||
to improve overall resilience.
|
||||
-->
|
||||
* [Deployment](/zh-cn/docs/concepts/workloads/controllers/deployment/) 和
|
||||
[ReplicaSet](/zh-cn/docs/concepts/workloads/controllers/replicaset/)
|
||||
* [`Deployment`](/zh-cn/docs/concepts/workloads/controllers/deployment/) 和
|
||||
[`ReplicaSet`](/zh-cn/docs/concepts/workloads/controllers/replicaset/)
|
||||
(替换原来的资源 {{< glossary_tooltip text="ReplicationController" term_id="replication-controller" >}})。
|
||||
`Deployment` 很适合用来管理你的集群上的无状态应用,`Deployment` 中的所有
|
||||
`Pod` 都是相互等价的,并且在需要的时候被替换。
|
||||
|
@ -127,14 +127,14 @@ then you can implement or install an extension that does provide that feature.
|
|||
<!--
|
||||
As well as reading about each resource, you can learn about specific tasks that relate to them:
|
||||
|
||||
* [Run a stateless application using a Deployment](/docs/tasks/run-application/run-stateless-application-deployment/)
|
||||
* [Run a stateless application using a `Deployment`](/docs/tasks/run-application/run-stateless-application-deployment/)
|
||||
* Run a stateful application either as a [single instance](/docs/tasks/run-application/run-single-instance-stateful-application/)
|
||||
or as a [replicated set](/docs/tasks/run-application/run-replicated-stateful-application/)
|
||||
* [Run Automated Tasks with a `CronJob`](/docs/tasks/job/automated-tasks-with-cron-jobs/)
|
||||
* [Run automated tasks with a `CronJob`](/docs/tasks/job/automated-tasks-with-cron-jobs/)
|
||||
-->
|
||||
除了阅读了解每类资源外,你还可以了解与这些资源相关的任务:
|
||||
|
||||
* [使用 Deployment 运行一个无状态的应用](/zh-cn/docs/tasks/run-application/run-stateless-application-deployment/)
|
||||
* [使用 `Deployment` 运行一个无状态的应用](/zh-cn/docs/tasks/run-application/run-stateless-application-deployment/)
|
||||
* 以[单实例](/zh-cn/docs/tasks/run-application/run-single-instance-stateful-application/)或者[多副本集合](/zh-cn/docs/tasks/run-application/run-replicated-stateful-application/)
|
||||
的形式运行有状态的应用;
|
||||
* [使用 `CronJob` 运行自动化的任务](/zh-cn/docs/tasks/job/automated-tasks-with-cron-jobs/)
|
||||
|
|
|
@ -92,9 +92,9 @@ as documented in [Resources](#resources).
|
|||
Also, init containers do not support `lifecycle`, `livenessProbe`, `readinessProbe`, or
|
||||
`startupProbe` because they must run to completion before the Pod can be ready.
|
||||
|
||||
If you specify multiple init containers for a Pod, Kubelet runs each init
|
||||
If you specify multiple init containers for a Pod, kubelet runs each init
|
||||
container sequentially. Each init container must succeed before the next can run.
|
||||
When all of the init containers have run to completion, Kubelet initializes
|
||||
When all of the init containers have run to completion, kubelet initializes
|
||||
the application containers for the Pod and runs them as usual.
|
||||
-->
|
||||
### 与普通容器的不同之处
|
||||
|
@ -184,6 +184,7 @@ Here are some ideas for how to use init containers:
|
|||
```shell
|
||||
sleep 60
|
||||
```
|
||||
|
||||
<!--
|
||||
* Clone a Git repository into a {{< glossary_tooltip text="Volume" term_id="volume" >}}
|
||||
|
||||
|
@ -364,15 +365,15 @@ To create the `mydb` and `myservice` services:
|
|||
创建 `mydb` 和 `myservice` 服务的命令:
|
||||
|
||||
```shell
|
||||
kubectl create -f services.yaml
|
||||
kubectl apply -f services.yaml
|
||||
```
|
||||
<!--
|
||||
The output is similar to this:
|
||||
-->
|
||||
输出类似于:
|
||||
```
|
||||
service "myservice" created
|
||||
service "mydb" created
|
||||
service/myservice created
|
||||
service/mydb created
|
||||
```
|
||||
|
||||
<!--
|
||||
|
|
|
@ -48,7 +48,7 @@ Before reviewing, it's a good idea to:
|
|||
|
||||
Before you start a review:
|
||||
|
||||
- Read the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md) and ensure that you abide by it at all times.
|
||||
- Read the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md) and ensure that you abide by it at all times.
|
||||
- Be polite, considerate, and helpful.
|
||||
- Comment on positive aspects of PRs as well as changes.
|
||||
- Be empathetic and mindful of how your review may be received.
|
||||
|
@ -59,7 +59,7 @@ Before you start a review:
|
|||
|
||||
在你开始评审之前:
|
||||
|
||||
- 阅读 [CNCF 行为准则](https://github.com/cncf/foundation/blob/master/code-of-conduct.md)。
|
||||
- 阅读 [CNCF 行为准则](https://github.com/cncf/foundation/blob/main/code-of-conduct.md)。
|
||||
确保你会始终遵从其中约定。
|
||||
- 保持有礼貌、体谅他人,怀助人为乐初心。
|
||||
- 评论时若给出修改建议,也要兼顾 PR 的积极方面。
|
||||
|
@ -113,15 +113,16 @@ Figure 1. Review process steps.
|
|||
图 1. 评审流程步骤。
|
||||
|
||||
<!--
|
||||
1. Go to
|
||||
[https://github.com/kubernetes/website/pulls](https://github.com/kubernetes/website/pulls).
|
||||
You see a list of every open pull request against the Kubernetes website and
|
||||
docs.
|
||||
1. Go to [https://github.com/kubernetes/website/pulls](https://github.com/kubernetes/website/pulls).
|
||||
You see a list of every open pull request against the Kubernetes website and docs.
|
||||
|
||||
2. Filter the open PRs using one or all of the following labels:
|
||||
- `cncf-cla: yes` (Recommended): PRs submitted by contributors who have not signed the CLA cannot be merged. See [Sign the CLA](/docs/contribute/new-content/overview/#sign-the-cla) for more information.
|
||||
- `language/en` (Recommended): Filters for english language PRs only.
|
||||
- `size/<size>`: filters for PRs of a certain size. If you're new, start with smaller PRs.
|
||||
2. Filter the open PRs using one or all of the following labels:
|
||||
|
||||
- `cncf-cla: yes` (Recommended): PRs submitted by contributors who have not signed the CLA
|
||||
cannot be merged. See [Sign the CLA](/docs/contribute/new-content/#sign-the-cla)
|
||||
for more information.
|
||||
- `language/en` (Recommended): Filters for english language PRs only.
|
||||
- `size/<size>`: filters for PRs of a certain size. If you're new, start with smaller PRs.
|
||||
|
||||
Additionally, ensure the PR isn't marked as a work in progress. PRs using the `work in progress` label are not ready for review yet.
|
||||
-->
|
||||
|
@ -130,25 +131,25 @@ Figure 1. Review process steps.
|
|||
|
||||
2. 使用以下标签(组合)对待处理 PR 进行过滤:
|
||||
|
||||
- `cncf-cla: yes` (建议):由尚未签署 CLA 的贡献者所发起的 PR 不可以合并。
|
||||
参考[签署 CLA](/zh-cn/docs/contribute/new-content/#sign-the-cla) 以了解更多信息。
|
||||
- `language/en` (建议):仅查看英语语言的 PR。
|
||||
- `size/<尺寸>`:过滤特定尺寸(规模)的 PR。
|
||||
如果你刚入门,可以从较小的 PR 开始。
|
||||
- `cncf-cla: yes` (建议):由尚未签署 CLA 的贡献者所发起的 PR 不可以合并。
|
||||
参考[签署 CLA](/zh-cn/docs/contribute/new-content/#sign-the-cla) 以了解更多信息。
|
||||
- `language/en` (建议):仅查看英语语言的 PR。
|
||||
- `size/<尺寸>`:过滤特定尺寸(规模)的 PR。
|
||||
如果你刚入门,可以从较小的 PR 开始。
|
||||
|
||||
此外,确保 PR 没有标记为尚未完成(Work in Progress)。
|
||||
包含 `work in progress` 的 PR 通常还没准备好被评审。
|
||||
此外,确保 PR 没有标记为尚未完成(Work in Progress)。
|
||||
包含 `work in progress` 的 PR 通常还没准备好被评审。
|
||||
|
||||
<!--
|
||||
3. Once you've selected a PR to review, understand the change by:
|
||||
- Reading the PR description to understand the changes made, and read any linked issues
|
||||
- Reading any comments by other reviewers
|
||||
- Clicking the **Files changed** tab to see the files and lines changed
|
||||
- Previewing the changes in the Netlify preview build by scrolling to the PR's build check section at the bottom of the **Conversation** tab.
|
||||
Here's a screenshot (this shows GitHub's desktop site; if you're reviewing
|
||||
on a tablet or smartphone device, the GitHub web UI is slightly different):
|
||||
{{< figure src="/images/docs/github_netlify_deploy_preview.png" alt="GitHub pull request details including link to Netlify preview" >}}
|
||||
To open the preview, click on the **Details** link of the **deploy/netlify** line in the list of checks.
|
||||
- Reading the PR description to understand the changes made, and read any linked issues
|
||||
- Reading any comments by other reviewers
|
||||
- Clicking the **Files changed** tab to see the files and lines changed
|
||||
- Previewing the changes in the Netlify preview build by scrolling to the PR's build check section at the bottom of the **Conversation** tab.
|
||||
Here's a screenshot (this shows GitHub's desktop site; if you're reviewing
|
||||
on a tablet or smartphone device, the GitHub web UI is slightly different):
|
||||
{{< figure src="/images/docs/github_netlify_deploy_preview.png" alt="GitHub pull request details including link to Netlify preview" >}}
|
||||
To open the preview, click on the **Details** link of the **deploy/netlify** line in the list of checks.
|
||||
-->
|
||||
3. 选定 PR 评审之后,可以通过以下方式理解所作的变更:
|
||||
|
||||
|
@ -165,24 +166,41 @@ Figure 1. Review process steps.
|
|||
|
||||
<!--
|
||||
4. Go to the **Files changed** tab to start your review.
|
||||
1. Click on the `+` symbol beside the line you want to comment on.
|
||||
2. Fill in any comments you have about the line and click either **Add single comment** (if you have only one comment to make) or **Start a review** (if you have multiple comments to make).
|
||||
3. When finished, click **Review changes** at the top of the page. Here, you can add
|
||||
a summary of your review (and leave some positive comments for the contributor!),
|
||||
approve the PR, comment or request changes as needed. New contributors should always
|
||||
choose **Comment**.
|
||||
|
||||
1. Click on the `+` symbol beside the line you want to comment on.
|
||||
1. Fill in any comments you have about the line and click either **Add single comment**
|
||||
(if you have only one comment to make) or **Start a review** (if you have multiple comments to make).
|
||||
1. When finished, click **Review changes** at the top of the page. Here, you can add
|
||||
a summary of your review (and leave some positive comments for the contributor!).
|
||||
Please always use the "Comment"
|
||||
|
||||
- Avoid clicking the "Request changes" button when finishing your review.
|
||||
If you want to block a PR from being merged before some further changes are made,
|
||||
you can leave a "/hold" comment.
|
||||
Mention why you are setting a hold, and optionally specify the conditions under
|
||||
which the hold can be removed by you or other reviewers.
|
||||
|
||||
- Avoid clicking the "Approve" button when finishing your review.
|
||||
Leaving a "/approve" comment is recommended most of the time.
|
||||
|
||||
-->
|
||||
4. 前往 **Files changed** Tab 页面,开始你的评审工作。
|
||||
|
||||
1. 点击你希望评论的行旁边的 `+` 号。
|
||||
2. 填写你对该行的评论,
|
||||
1. 填写你对该行的评论,
|
||||
之后选择 **Add single comment**(如果你只有一条评论)
|
||||
或者 **Start a review**(如果你还有其他评论要添加)。
|
||||
3. 评论结束时,点击页面顶部的 **Review changes**。
|
||||
1. 评论结束时,点击页面顶部的 **Review changes**。
|
||||
这里你可以添加你的评论结语(记得留下一些正能量的评论!)、
|
||||
根据需要批准 PR、请求作者进一步修改等等。
|
||||
新手应该选择 **Comment**。
|
||||
|
||||
- 避免在完成审查后点击 "Request changes(请求修改)"按钮。
|
||||
如果在完成进一步修改之前你想阻止某 PR 被合并。你可以在评论中留下一个 “/hold”。
|
||||
同时在评论中说明你为什么要设置 Hold,并且在必要时指定在什么条件下可以由你或其他评审人取消 Hold。
|
||||
- 避免在完成审查后直接点击 "Approve(批准)"按钮。
|
||||
在大多数情况下,建议在评论区留下一个"/approve(批准)"的评论。
|
||||
|
||||
<!--
|
||||
## Reviewing checklist
|
||||
|
||||
|
|
Loading…
Reference in New Issue