You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/zh-cn/docs/concepts/overview/working-with-objects/kubernetes-objects.md
+62-44Lines changed: 62 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,42 +20,54 @@ card:
20
20
<!--
21
21
This page explains how Kubernetes objects are represented in the Kubernetes API, and how you can express them in `.yaml` format.
22
22
-->
23
-
本页说明了 Kubernetes 对象在 Kubernetes API 中是如何表示的,以及如何在 `.yaml` 格式的文件中表示。
24
-
23
+
本页说明了在 Kubernetes API 中是如何表示 Kubernetes 对象的,
24
+
以及使用 `.yaml` 格式的文件表示 Kubernetes 对象。
25
25
26
26
<!-- body -->
27
27
<!--
28
28
## Understanding Kubernetes Objects
29
29
30
-
*Kubernetes Objects* are persistent entities in the Kubernetes system. Kubernetes uses these entities to represent the state of your cluster. Specifically, they can describe:
30
+
*Kubernetes Objects* are persistent entities in the Kubernetes system.
31
+
Kubernetes uses these entities to represent the state of your cluster.
32
+
33
+
Specifically, they can describe:
31
34
32
35
* What containerized applications are running (and on which nodes)
33
36
* The resources available to those applications
34
37
* The policies around how those applications behave, such as restart policies, upgrades, and fault-tolerance
35
38
-->
36
-
## 理解 Kubernetes 对象
39
+
## 理解 Kubernetes 对象 {#kubernetes-objects}
37
40
38
41
在 Kubernetes 系统中,*Kubernetes 对象* 是持久化的实体。
39
-
Kubernetes 使用这些实体去表示整个集群的状态。特别地,它们描述了如下信息:
42
+
Kubernetes 使用这些实体去表示整个集群的状态。
43
+
比較特别地是,它们描述了如下信息:
40
44
41
-
*哪些容器化应用在运行(以及在哪些节点上)
45
+
*哪些容器化应用正在运行(以及在哪些节点上运行)
42
46
* 可以被应用使用的资源
43
47
* 关于应用运行时表现的策略,比如重启策略、升级策略,以及容错策略
44
48
45
49
<!--
46
-
A Kubernetes object is a "record of intent" - once you create the object, the Kubernetes system will constantly work to ensure that object exists. By creating an object, you're effectively telling the Kubernetes system what you want your cluster's workload to look like; this is your cluster's *desired state*.
47
-
48
-
To work with Kubernetes objects - whether to create, modify, or delete them - you'll need to use the [Kubernetes API](/docs/concepts/overview/kubernetes-api/). When you use the `kubectl` command-line interface, for example, the CLI makes the necessary Kubernetes API calls for you. You can also use the Kubernetes API directly in your own programs using one of the [Client Libraries](/docs/reference/using-api/client-libraries/).
50
+
A Kubernetes object is a "record of intent" - once you create the object,
51
+
the Kubernetes system will constantly work to ensure that object exists.
52
+
By creating an object, you're effectively telling the Kubernetes system what
53
+
you want your cluster's workload to look like; this is your cluster's *desired state*.
54
+
55
+
To work with Kubernetes objects - whether to create, modify, or delete them -
56
+
you'll need to use the [Kubernetes API](/docs/concepts/overview/kubernetes-api/).
57
+
When you use the `kubectl` command-line interface, for example,
58
+
the CLI makes the necessary Kubernetes API calls for you.
59
+
You can also use the Kubernetes API directly in your own programs using
60
+
one of the [Client Libraries](/docs/reference/using-api/client-libraries/).
For more information on the object spec, status, and metadata, see the [Kubernetes API Conventions](https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md).
118
+
For more information on the object spec, status, and metadata, see the
119
+
[Kubernetes API Conventions](https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md).
108
120
-->
109
-
110
121
关于对象 spec、status 和 metadata 的更多信息,可参阅
111
122
[Kubernetes API 约定](https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md)。
112
123
113
124
<!--
114
125
### Describing a Kubernetes Object
115
126
116
-
When you create an object in Kubernetes, you must provide the object spec that describes its desired state, as well as some basic information about the object (such as a name). When you use the Kubernetes API to create the object (either directly or via `kubectl`), that API request must include that information as JSON in the request body. **Most often, you provide the information to `kubectl` in a .yaml file.** `kubectl` converts the information to JSON when making the API request.
127
+
When you create an object in Kubernetes, you must provide the object spec that describes its desired state,
128
+
as well as some basic information about the object (such as a name).
129
+
When you use the Kubernetes API to create the object (either directly or via `kubectl`),
130
+
that API request must include that information as JSON in the request body.
131
+
**Most often, you provide the information to `kubectl` in a .yaml file.** `kubectl` converts the information to JSON when making the API request.
117
132
118
133
Here's an example `.yaml` file that shows the required fields and object spec for a Kubernetes Deployment:
The precise format of the object `spec` is different for every Kubernetes object, and contains nested fields specific to that object. The [Kubernetes API Reference](https://kubernetes.io/docs/reference/kubernetes-api/) can help you find the spec format for all of the objects you can create using Kubernetes.
190
+
The precise format of the object `spec` is different for every Kubernetes object,
191
+
and contains nested fields specific to that object.
192
+
The [Kubernetes API Reference](https://kubernetes.io/docs/reference/kubernetes-api/)
193
+
can help you find the spec format for all of the objects you can create using Kubernetes.
0 commit comments