@@ -3,7 +3,6 @@ title: "容器"
3
3
weight : 40
4
4
description : 打包应用及其运行依赖环境的技术。
5
5
content_type : concept
6
- no_list : true
7
6
---
8
7
9
8
<!-- overview -->
@@ -14,13 +13,22 @@ run it.
14
13
15
14
Containers decouple applications from underlying host infrastructure.
16
15
This makes deployment easier in different cloud or OS environments.
16
+
17
+ Each {{< glossary_tooltip text="node" term_id="node" >}} in a Kubernetes
18
+ cluster runs the containers that form the
19
+ [Pods](/docs/concepts/workloads/pods/) assigned to that node.
20
+ Containers in a Pod are co-located and co-scheduled to run on the same node.
17
21
-->
18
22
每个运行的容器都是可重复的;
19
23
包含依赖环境在内的标准,意味着无论你在哪里运行它都会得到相同的行为。
20
24
21
25
容器将应用程序从底层的主机设施中解耦。
22
26
这使得在不同的云或 OS 环境中部署更加容易。
23
27
28
+ Kubernetes 集群中的每个{{< glossary_tooltip text="节点" term_id="node" >}}都会运行容器,
29
+ 这些容器构成分配给该节点的 [ Pod] ( /zh-cn/docs/concepts/workloads/pods/ ) 。
30
+ 单个 Pod 中的容器会在共同调度下,于同一位置运行在相同的节点上。
31
+
24
32
<!-- body -->
25
33
<!--
26
34
## Container images
@@ -29,31 +37,40 @@ software package, containing everything needed to run an application:
29
37
the code and any runtime it requires, application and system libraries,
30
38
and default values for any essential settings.
31
39
32
- By design, a container is immutable: you cannot change the code of a
33
- container that is already running. If you have a containerized application
34
- and want to make changes, you need to build a new image that includes
35
- the change, then recreate the container to start from the updated image.
40
+ Containers are intended to be stateless and
41
+ [immutable](https://glossary.cncf.io/immutable-infrastructure/):
42
+ you should not change
43
+ the code of a container that is already running. If you have a containerized
44
+ application and want to make changes, the correct process is to build a new
45
+ image that includes the change, then recreate the container to start from the
46
+ updated image.
36
47
-->
37
48
38
49
## 容器镜像 {#container-images}
39
50
[ 容器镜像] ( /zh-cn/docs/concepts/containers/images/ ) 是一个随时可以运行的软件包,
40
51
包含运行应用程序所需的一切:代码和它需要的所有运行时、应用程序和系统库,以及一些基本设置的默认值。
41
52
42
- 根据设计,容器是不可变的:你不能更改已经运行的容器的代码。
43
- 如果有一个容器化的应用程序需要修改,则需要构建包含更改的新镜像,然后再基于新构建的镜像重新运行容器。
53
+ 容器旨在设计成无状态且[ 不可变的] ( https://glossary.cncf.io/immutable-infrastructure/ ) :
54
+ 你不应更改已经运行的容器的代码。如果有一个容器化的应用程序需要修改,
55
+ 正确的流程是:先构建包含更改的新镜像,再基于新构建的镜像重新运行容器。
44
56
45
57
<!-- ## Container runtimes -->
46
58
## 容器运行时 {#container-runtimes}
47
59
48
60
{{< glossary_definition term_id="container-runtime" length="all" >}}
49
61
50
- ## {{% heading "whatsnext" %}}
51
62
<!--
52
- * Read about [container images](/docs/concepts/containers/images/)
53
- * Read about [Pods](/docs/concepts/workloads/pods/)
54
- -->
55
-
56
- * 进一步阅读[ 容器镜像] ( /zh-cn/docs/concepts/containers/images/ )
57
- * 进一步阅读 [ Pods] ( /zh-cn/docs/concepts/workloads/pods/ )
63
+ Usually, you can allow your cluster to pick the default container runtime
64
+ for a Pod. If you need to use more than one container runtime in your cluster,
65
+ you can specify the [RuntimeClass](/docs/concepts/containers/runtime-class/)
66
+ for a Pod to make sure that Kubernetes runs those containers using a
67
+ particular container runtime.
58
68
69
+ You can also use RuntimeClass to run different Pods with the same container
70
+ runtime but with different settings.
71
+ -->
72
+ 通常,你可以允许集群为一个 Pod 选择其默认的容器运行时。如果你需要在集群中使用多个容器运行时,
73
+ 你可以为一个 Pod 指定 [ RuntimeClass] ( /zh-cn/docs/concepts/containers/runtime-class/ ) ,
74
+ 以确保 Kubernetes 会使用特定的容器运行时来运行这些容器。
59
75
76
+ 你还可以通过 RuntimeClass,使用相同的容器运行时,但使用不同设定的配置来运行不同的 Pod。
0 commit comments