[zh] Update workloads/pods/_index.md
Signed-off-by: xin.li <xin.li@daocloud.io>
This commit is contained in:
@@ -92,6 +92,37 @@ Pod 的共享上下文包括一组 Linux 名字空间、控制组(cgroup)和
|
|||||||
<!--
|
<!--
|
||||||
## Using Pods
|
## Using Pods
|
||||||
|
|
||||||
|
The following is an example of a Pod which consists of a container running the image `nginx:1.14.2`.
|
||||||
|
|
||||||
|
{{< codenew file="pods/simple-pod.yaml" >}}
|
||||||
|
|
||||||
|
To create the Pod shown above, run the following command:
|
||||||
|
-->
|
||||||
|
## 使用 Pod {#using-pods}
|
||||||
|
|
||||||
|
下面是一个 Pod 示例,它由一个运行镜像 `nginx:1.14.2` 的容器组成。
|
||||||
|
|
||||||
|
{{< codenew file="pods/simple-pod.yaml" >}}
|
||||||
|
|
||||||
|
要创建上面显示的 Pod,请运行以下命令:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
kubectl apply -f https://k8s.io/examples/pods/simple-pod.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Pods are generally not created directly and are created using workload resources.
|
||||||
|
See [Working with Pods](#working-with-pods) for more information on how Pods are used
|
||||||
|
with workload resources.
|
||||||
|
|
||||||
|
### Workload resources for managing pods
|
||||||
|
-->
|
||||||
|
Pod 通常不是直接创建的,而是使用工作负载资源创建的。
|
||||||
|
有关如何将 Pod 用于工作负载资源的更多信息,请参阅 [使用 Pod](#working-with-pods)。
|
||||||
|
|
||||||
|
### 用于管理 pod 的工作负载资源
|
||||||
|
|
||||||
|
<!--
|
||||||
Usually you don't need to create Pods directly, even singleton Pods.
|
Usually you don't need to create Pods directly, even singleton Pods.
|
||||||
Instead, create them using workload resources such as {{< glossary_tooltip text="Deployment"
|
Instead, create them using workload resources such as {{< glossary_tooltip text="Deployment"
|
||||||
term_id="deployment" >}} or {{< glossary_tooltip text="Job" term_id="job" >}}.
|
term_id="deployment" >}} or {{< glossary_tooltip text="Job" term_id="job" >}}.
|
||||||
@@ -100,8 +131,6 @@ If your Pods need to track state, consider the
|
|||||||
|
|
||||||
Pods in a Kubernetes cluster are used in two main ways:
|
Pods in a Kubernetes cluster are used in two main ways:
|
||||||
-->
|
-->
|
||||||
## 使用 Pod {#using-pods}
|
|
||||||
|
|
||||||
通常你不需要直接创建 Pod,甚至单实例 Pod。
|
通常你不需要直接创建 Pod,甚至单实例 Pod。
|
||||||
相反,你会使用诸如
|
相反,你会使用诸如
|
||||||
{{< glossary_tooltip text="Deployment" term_id="deployment" >}} 或
|
{{< glossary_tooltip text="Deployment" term_id="deployment" >}} 或
|
||||||
@@ -187,9 +216,9 @@ that updates those files from a remote source, as in the following diagram:
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
例如,你可能有一个容器,为共享卷中的文件提供 Web 服务器支持,以及一个单独的
|
例如,你可能有一个容器,为共享卷中的文件提供 Web 服务器支持,以及一个单独的
|
||||||
“sidecar(挂斗)”容器负责从远端更新这些文件,如下图所示:
|
"边车 (sidercar)" 容器负责从远端更新这些文件,如下图所示:
|
||||||
|
|
||||||
{{< figure src="/images/docs/pod.svg" alt="example pod diagram" width="50%" >}}
|
{{< figure src="/images/docs/pod.svg" alt="Pod creation diagram" class="diagram-medium" >}}
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Some Pods have {{< glossary_tooltip text="init containers" term_id="init-container" >}}
|
Some Pods have {{< glossary_tooltip text="init containers" term_id="init-container" >}}
|
||||||
@@ -287,7 +316,7 @@ _Pod 模板(Pod Template)_ 来替你创建 Pod 并管理它们。
|
|||||||
Pod 模板是包含在工作负载对象中的规范,用来创建 Pod。这类负载资源包括
|
Pod 模板是包含在工作负载对象中的规范,用来创建 Pod。这类负载资源包括
|
||||||
[Deployment](/zh/docs/concepts/workloads/controllers/deployment/)、
|
[Deployment](/zh/docs/concepts/workloads/controllers/deployment/)、
|
||||||
[Job](/zh/docs/concepts/workloads/controllers/job/) 和
|
[Job](/zh/docs/concepts/workloads/controllers/job/) 和
|
||||||
[DaemonSets](/zh/docs/concepts/workloads/controllers/daemonset/)等。
|
[DaemonSets](/zh/docs/concepts/workloads/controllers/daemonset/) 等。
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Each controller for a workload resource uses the `PodTemplate` inside the workload
|
Each controller for a workload resource uses the `PodTemplate` inside the workload
|
||||||
@@ -314,7 +343,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: hello
|
- name: hello
|
||||||
image: busybox
|
image: busybox:1.28
|
||||||
command: ['sh', '-c', 'echo "Hello, Kubernetes!" && sleep 3600']
|
command: ['sh', '-c', 'echo "Hello, Kubernetes!" && sleep 3600']
|
||||||
restartPolicy: OnFailure
|
restartPolicy: OnFailure
|
||||||
# 以上为 Pod 模版
|
# 以上为 Pod 模版
|
||||||
@@ -345,7 +374,7 @@ details are abstracted away. That abstraction and separation of concerns simplif
|
|||||||
system semantics, and makes it feasible to extend the cluster's behavior without
|
system semantics, and makes it feasible to extend the cluster's behavior without
|
||||||
changing existing code.
|
changing existing code.
|
||||||
-->
|
-->
|
||||||
在节点上,{{< glossary_tooltip term_id="kubelet" text="kubelet" >}}并不直接监测
|
在节点上,{{< glossary_tooltip term_id="kubelet" text="kubelet" >}} 并不直接监测
|
||||||
或管理与 Pod 模版相关的细节或模版的更新,这些细节都被抽象出来。
|
或管理与 Pod 模版相关的细节或模版的更新,这些细节都被抽象出来。
|
||||||
这种抽象和关注点分离简化了整个系统的语义,并且使得用户可以在不改变现有代码的
|
这种抽象和关注点分离简化了整个系统的语义,并且使得用户可以在不改变现有代码的
|
||||||
前提下就能扩展集群的行为。
|
前提下就能扩展集群的行为。
|
||||||
@@ -459,14 +488,13 @@ can find each other via `localhost`. The containers in a Pod can also communicat
|
|||||||
with each other using standard inter-process communications like SystemV semaphores
|
with each other using standard inter-process communications like SystemV semaphores
|
||||||
or POSIX shared memory. Containers in different Pods have distinct IP addresses
|
or POSIX shared memory. Containers in different Pods have distinct IP addresses
|
||||||
and can not communicate by IPC without
|
and can not communicate by IPC without
|
||||||
[special configuration](/docs/concepts/policy/pod-security-policy/).
|
and can not communicate by OS-level IPC without special configuration.
|
||||||
Containers that want to interact with a container running in a different Pod can
|
Containers that want to interact with a container running in a different Pod can
|
||||||
use IP networking to communicate.
|
use IP networking to communicate.
|
||||||
-->
|
-->
|
||||||
在同一个 Pod 内,所有容器共享一个 IP 地址和端口空间,并且可以通过 `localhost` 发现对方。
|
在同一个 Pod 内,所有容器共享一个 IP 地址和端口空间,并且可以通过 `localhost` 发现对方。
|
||||||
他们也能通过如 SystemV 信号量或 POSIX 共享内存这类标准的进程间通信方式互相通信。
|
他们也能通过如 SystemV 信号量或 POSIX 共享内存这类标准的进程间通信方式互相通信。
|
||||||
不同 Pod 中的容器的 IP 地址互不相同,没有
|
不同 Pod 中的容器的 IP 地址互不相同,没有特殊配置,无法通过 OS 级 IPC 进行通信就不能使用 IPC 进行通信。
|
||||||
[特殊配置](/zh/docs/concepts/policy/pod-security-policy/) 就不能使用 IPC 进行通信。
|
|
||||||
如果某容器希望与运行于其他 Pod 中的容器通信,可以通过 IP 联网的方式实现。
|
如果某容器希望与运行于其他 Pod 中的容器通信,可以通过 IP 联网的方式实现。
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|||||||
Reference in New Issue
Block a user