[zh] update concept basic objects
This commit is contained in:
@@ -26,7 +26,7 @@ card:
|
||||
When you deploy Kubernetes, you get a cluster.
|
||||
{{</* glossary_definition term_id="cluster" length="all" prepend="A Kubernetes cluster consists of" */>}}
|
||||
|
||||
This document outlines the various components you need to have
|
||||
This document outlines the various components you need to have for
|
||||
a complete and working Kubernetes cluster.
|
||||
|
||||
Here's the diagram of a Kubernetes cluster with all the components tied together.
|
||||
|
||||
@@ -48,6 +48,15 @@ Annotations, like labels, are key/value maps:
|
||||
}
|
||||
```
|
||||
|
||||
{{<note>}}
|
||||
<!--
|
||||
The keys and the values in the map must be strings. In other words, you cannot use
|
||||
numeric, boolean, list or other types for either the keys or the values.
|
||||
-->
|
||||
Map 中的键和值必须是字符串。
|
||||
换句话说,你不能使用数字、布尔值、列表或其他类型的键或值。
|
||||
{{</note>}}
|
||||
|
||||
<!--
|
||||
Here are some examples of information that could be recorded in annotations:
|
||||
-->
|
||||
|
||||
@@ -93,7 +93,7 @@ kubectl get pods --field-selector=status.phase!=Running,spec.restartPolicy=Alway
|
||||
<!--
|
||||
## Multiple resource types
|
||||
|
||||
You use field selectors across multiple resource types. This `kubectl` command selects all Statefulsets and Services that are not in the `default` namespace:
|
||||
You can use field selectors across multiple resource types. This `kubectl` command selects all Statefulsets and Services that are not in the `default` namespace:
|
||||
-->
|
||||
## 多种资源类型 {#multiple-resource-types}
|
||||
|
||||
|
||||
@@ -160,6 +160,7 @@ In the `.yaml` file for the Kubernetes object you want to create, you'll need to
|
||||
* `apiVersion` - Which version of the Kubernetes API you're using to create this object
|
||||
* `kind` - What kind of object you want to create
|
||||
* `metadata` - Data that helps uniquely identify the object, including a `name` string, `UID`, and optional `namespace`
|
||||
* `spec` - What state you desire for the object
|
||||
-->
|
||||
### 必需字段 {#required-fields}
|
||||
|
||||
@@ -168,25 +169,23 @@ In the `.yaml` file for the Kubernetes object you want to create, you'll need to
|
||||
* `apiVersion` - 创建该对象所使用的 Kubernetes API 的版本
|
||||
* `kind` - 想要创建的对象的类别
|
||||
* `metadata` - 帮助唯一性标识对象的一些数据,包括一个 `name` 字符串、UID 和可选的 `namespace`
|
||||
* `spec` - 你所期望的该对象的状态
|
||||
|
||||
<!--
|
||||
You'll also need to provide the object `spec` field. 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](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/) can help you find the spec format for all of the objects you can create using Kubernetes.
|
||||
For example, the `spec` format for a `Pod` can be found
|
||||
[here](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podspec-v1-core),
|
||||
and the `spec` format for a `Deployment` can be found
|
||||
[here](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#deploymentspec-v1-apps).
|
||||
-->
|
||||
你也需要提供对象的 `spec` 字段。
|
||||
对象 `spec` 的精确格式对每个 Kubernetes 对象来说是不同的,包含了特定于该对象的嵌套字段。
|
||||
[Kubernetes API 参考](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/)
|
||||
能够帮助我们找到任何我们想创建的对象的 spec 格式。
|
||||
例如,可以从
|
||||
[core/v1 PodSpec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podspec-v1-core)
|
||||
查看 `Pod` 的 `spec` 格式,
|
||||
并且可以从
|
||||
[apps/v1 DeploymentSpec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#deploymentspec-v1-apps)
|
||||
查看 `Deployment` 的 `spec` 格式。
|
||||
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.
|
||||
|
||||
For example, the reference for Pod details the [`spec` field](/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodSpec)
|
||||
for a Pod in the API, and the reference for Deployment details the [`spec` field](/docs/reference/kubernetes-api/workload-resources/deployment-v1/#DeploymentSpec) for Deployments.
|
||||
In those API reference pages you'll see mention of PodSpec and DeploymentSpec. These names are implementation details of the Golang code that Kubernetes uses to implement its API.
|
||||
-->
|
||||
对象 `spec` 的精确格式对每个 Kubernetes 对象来说是不同的,包含了特定于该对象的嵌套字段。
|
||||
[Kubernetes API 参考](https://kubernetes.io/docs/reference/kubernetes-api/)
|
||||
能够帮助我们找到任何我们想创建的对象的规约格式。
|
||||
|
||||
例如,Pod 参考文档详细说明了 API 中 Pod 的 [`spec` 字段](/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodSpec),
|
||||
Deployment 的参考文档则详细说明了 Deployment 的 [`spec` 字段](/docs/reference/kubernetes-api/workload-resources/deployment-v1/#DeploymentSpec)。
|
||||
在这些 API 参考页面中,你将看到提到的 PodSpec 和 DeploymentSpec。
|
||||
这些名字是 Kubernetes 用来实现其 API 的 Golang 代码的实现细节。
|
||||
|
||||
## {{% heading "whatsnext" %}}
|
||||
|
||||
|
||||
@@ -70,11 +70,10 @@ Example labels:
|
||||
* `"track" : "daily"`, `"track" : "weekly"`
|
||||
|
||||
<!--
|
||||
These are just examples of commonly used labels;
|
||||
you are free to develop your own conventions.
|
||||
Keep in mind that label Key must be unique for a given object.
|
||||
These are examples of [commonly used labels](/docs/concepts/overview/working-with-objects/common-labels/); you are free to develop your own conventions. Keep in mind that label Key must be unique for a given object.
|
||||
-->
|
||||
这些只是常用标签的例子; 你可以任意制定自己的约定。请记住,对于给定对象标签的键必须是唯一的。
|
||||
有一些[常用标签](/zh/docs/concepts/overview/working-with-objects/common-labels/)的例子; 你可以任意制定自己的约定。
|
||||
请记住,标签的 Key 对于给定对象必须是唯一的。
|
||||
|
||||
<!--
|
||||
## Syntax and character set
|
||||
@@ -83,7 +82,7 @@ _Labels_ are key/value pairs. Valid label keys have two segments: an optional pr
|
||||
|
||||
If the prefix is omitted, the label Key is presumed to be private to the user. Automated system components (e.g. `kube-scheduler`, `kube-controller-manager`, `kube-apiserver`, `kubectl`, or other third-party automation) which add labels to end-user objects must specify a prefix.
|
||||
|
||||
The `kubernetes.io/` prefix is reserved for Kubernetes core components.
|
||||
The `kubernetes.io/` and `k8s.io/` prefixes are [reserved](/docs/reference/labels-annotations-taints/) for Kubernetes core components.
|
||||
-->
|
||||
## 语法和字符集
|
||||
|
||||
@@ -97,7 +96,7 @@ _标签_ 是键值对。有效的标签键有两个段:可选的前缀和名
|
||||
向最终用户对象添加标签的自动系统组件(例如 `kube-scheduler`、`kube-controller-manager`、
|
||||
`kube-apiserver`、`kubectl` 或其他第三方自动化工具)必须指定前缀。
|
||||
|
||||
`kubernetes.io/` 前缀是为 Kubernetes 核心组件保留的。
|
||||
`kubernetes.io/` 和 `k8s.io/` 前缀是为 Kubernetes 核心组件[保留的](/zh/docs/reference/labels-annotations-taints/)。
|
||||
|
||||
<!--
|
||||
Valid label value:
|
||||
|
||||
@@ -46,9 +46,9 @@ In cases when objects represent a physical entity, like a Node representing a ph
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
Below are three types of commonly used name constraints for resources.
|
||||
Below are four types of commonly used name constraints for resources.
|
||||
-->
|
||||
以下是比较常见的三种资源命名约束。
|
||||
以下是比较常见的四种资源命名约束。
|
||||
|
||||
<!--
|
||||
### DNS Subdomain Names
|
||||
@@ -86,16 +86,39 @@ This means the name must:
|
||||
- start with an alphanumeric character
|
||||
- end with an alphanumeric character
|
||||
-->
|
||||
### DNS 标签名 {#dns-label-names}
|
||||
### RFC 1123 标签名 {#dns-label-names}
|
||||
|
||||
某些资源类型需要其名称遵循 [RFC 1123](https://tools.ietf.org/html/rfc1123)
|
||||
所定义的 DNS 标签标准。也就是命名必须满足如下规则:
|
||||
|
||||
- 最多63个字符
|
||||
- 只能包含小写字母、数字,以及'-'
|
||||
- 最多 63 个字符
|
||||
- 只能包含小写字母、数字,以及 '-'
|
||||
- 须以字母数字开头
|
||||
- 须以字母数字结尾
|
||||
|
||||
|
||||
<!--
|
||||
### RFC 1035 Label Names
|
||||
|
||||
Some resource types require their names to follow the DNS
|
||||
label standard as defined in [RFC 1035](https://tools.ietf.org/html/rfc1035).
|
||||
This means the name must:
|
||||
|
||||
- contain at most 63 characters
|
||||
- contain only lowercase alphanumeric characters or '-'
|
||||
- start with an alphabetic character
|
||||
- end with an alphanumeric character
|
||||
-->
|
||||
### RFC 1035 标签名 {#rfc-1035-label-names}
|
||||
|
||||
某些资源类型需要其名称遵循 [RFC 1035](https://tools.ietf.org/html/rfc1035)
|
||||
所定义的 DNS 标签标准。也就是命名必须满足如下规则:
|
||||
|
||||
- 最多 63 个字符
|
||||
- 只能包含小写字母、数字,以及 '-'
|
||||
- 须以字母开头
|
||||
- 须以字母数字结尾
|
||||
|
||||
<!--
|
||||
### Path Segment Names
|
||||
|
||||
|
||||
@@ -101,20 +101,24 @@ kube-public Active 1d
|
||||
<!--
|
||||
Kubernetes starts with four initial namespaces:
|
||||
|
||||
* `default` The default namespace for objects with no other namespace
|
||||
* `kube-system` The namespace for objects created by the Kubernetes system
|
||||
* `kube-public` This namespace is created automatically and is readable by all users (including those not authenticated). This namespace is mostly reserved for cluster usage, in case that some resources should be visible and readable publicly throughout the whole cluster. The public aspect of this namespace is only a convention, not a requirement.
|
||||
* `kube-node-lease` This namespace for the lease objects associated with each node which improves the performance of the node heartbeats as the cluster scales.
|
||||
* `default` The default namespace for objects with no other namespace
|
||||
* `kube-system` The namespace for objects created by the Kubernetes system
|
||||
* `kube-public` This namespace is created automatically and is readable by all users (including those not authenticated). This namespace is mostly reserved for cluster usage, in case that some resources should be visible and readable publicly throughout the whole cluster. The public aspect of this namespace is only a convention, not a requirement.
|
||||
* `kube-node-lease` This namespace holds [Lease](/docs/reference/kubernetes-api/cluster-resources/lease-v1/)
|
||||
objects associated with each node. Node leases allow the kubelet to send
|
||||
[heartbeats](/docs/concepts/architecture/nodes/#heartbeats) so that the control plane
|
||||
can detect node failure.
|
||||
-->
|
||||
Kubernetes 会创建四个初始名字空间:
|
||||
|
||||
* `default` 没有指明使用其它名字空间的对象所使用的默认名字空间
|
||||
* `kube-system` Kubernetes 系统创建对象所使用的名字空间
|
||||
* `kube-public` 这个名字空间是自动创建的,所有用户(包括未经过身份验证的用户)都可以读取它。
|
||||
这个名字空间主要用于集群使用,以防某些资源在整个集群中应该是可见和可读的。
|
||||
这个名字空间的公共方面只是一种约定,而不是要求。
|
||||
* `kube-node-lease` 此名字空间用于与各个节点相关的租期(Lease)对象;
|
||||
此对象的设计使得集群规模很大时节点心跳检测性能得到提升。
|
||||
* `default` 没有指明使用其它名字空间的对象所使用的默认名字空间
|
||||
* `kube-system` Kubernetes 系统创建对象所使用的名字空间
|
||||
* `kube-public` 这个名字空间是自动创建的,所有用户(包括未经过身份验证的用户)都可以读取它。
|
||||
这个名字空间主要用于集群使用,以防某些资源在整个集群中应该是可见和可读的。
|
||||
这个名字空间的公共方面只是一种约定,而不是要求。
|
||||
* `kube-node-lease` 此名字空间用于与各个节点相关的
|
||||
[租约(Lease)](/docs/reference/kubernetes-api/cluster-resources/lease-v1/)对象。
|
||||
节点租期允许 kubelet 发送[心跳](/zh/docs/concepts/architecture/nodes/#heartbeats),由此控制面能够检测到节点故障。
|
||||
|
||||
<!--
|
||||
### Setting the namespace for a request
|
||||
|
||||
Reference in New Issue
Block a user