Skip to content

Commit b03ba92

Browse files
authored
Merge pull request #42361 from my-git9/patcher
[zh-cn] sync node-labels namepaces security-context assign-cpu-resource
2 parents a652804 + a9e4bfb commit b03ba92

File tree

4 files changed

+91
-16
lines changed

4 files changed

+91
-16
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
content_type: "reference"
2+
title: 由 kubelet 填充的节点标签
3+
weight: 40
4+
5+
<!--
6+
content_type: "reference"
7+
title: Node Labels Populated By The Kubelet
8+
weight: 40
9+
-->
10+
11+
<!--
12+
Kubernetes {{< glossary_tooltip text="nodes" term_id="node" >}} come pre-populated
13+
with a standard set of {{< glossary_tooltip text="labels" term_id="label" >}}.
14+
15+
You can also set your own labels on nodes, either through the kubelet configuration or
16+
using the Kubernetes API.
17+
-->
18+
Kubernetes {{< glossary_tooltip text="节点" term_id="node" >}}预先填充了一组标准
19+
{{< glossary_tooltip text="标签" term_id="label" >}}。
20+
21+
你还可以通过 kubelet 配置或使用 Kubernetes API 在节点上设置自己的标签。
22+
23+
<!--
24+
## Preset labels
25+
26+
The preset labels that Kubernetes sets on nodes are:
27+
-->
28+
## 预设标签
29+
30+
Kubernetes 在节点上设置的预设标签有:
31+
32+
<!--
33+
* [`kubernetes.io/arch`](/docs/reference/labels-annotations-taints/#kubernetes-io-arch)
34+
* [`kubernetes.io/hostname`](/docs/reference/labels-annotations-taints/#kubernetes-io-hostname)
35+
* [`kubernetes.io/os`](/docs/reference/labels-annotations-taints/#kubernetes-io-os)
36+
* [`node.kubernetes.io/instance-type`](/docs/reference/labels-annotations-taints/#nodekubernetesioinstance-type)
37+
(if known to the kubelet &ndash; Kubernetes may not have this information to set the label)
38+
* [`topology.kubernetes.io/region`](/docs/reference/labels-annotations-taints/#topologykubernetesioregion)
39+
(if known to the kubelet &ndash; Kubernetes may not have this information to set the label)
40+
* [`topology.kubernetes.io/zone`](/docs/reference/labels-annotations-taints/#topologykubernetesiozone)
41+
(if known to the kubelet &ndash; Kubernetes may not have this information to set the label)
42+
-->
43+
* [`kubernetes.io/arch`](/zh-cn/docs/reference/labels-annotations-taints/#kubernetes-io-arch)
44+
* [`kubernetes.io/hostname`](/zh-cn/docs/reference/labels-annotations-taints/#kubernetes-io-hostname)
45+
* [`kubernetes.io/os`](/zh-cn/docs/reference/labels-annotations-taints/#kubernetes-io-os)
46+
* [`node.kubernetes.io/instance-type`](/zh-cn/docs/reference/labels-annotations-taints/#nodekubernetesioinstance-type)
47+
(如果 kubelet 知道此信息 &ndash; Kubernetes 可能没有这些信息来设置标签)
48+
* [`topology.kubernetes.io/region`](/zh-cn/docs/reference/labels-annotations-taints/#topologykubernetesioregion)
49+
(如果 kubelet 知道此信息 &ndash; Kubernetes 可能没有这些信息来设置标签)
50+
* [`topology.kubernetes.io/zone`](/zh-cn/docs/reference/labels-annotations-taints/#topologykubernetesiozone)
51+
(如果 kubelet 知道此信息 &ndash; Kubernetes 可能没有这些信息来设置标签)
52+
53+
{{<note>}}
54+
<!--
55+
The value of these labels is cloud provider specific and is not guaranteed to be reliable.
56+
For example, the value of `kubernetes.io/hostname` may be the same as the node name in some environments
57+
and a different value in other environments.
58+
-->
59+
这些标签的值是特定于云提供商的,并且不保证其可靠性。
60+
例如,`kubernetes.io/hostname` 的值在某些环境中可能与节点名称相同,
61+
而在其他环境中可能与节点名称不同。
62+
{{</note>}}
63+
64+
## {{% heading "whatsnext" %}}
65+
66+
<!--
67+
- See [Well-Known Labels, Annotations and Taints](/docs/reference/labels-annotations-taints/) for a list of common labels.
68+
- Learn how to [add a label to a node](/docs/tasks/configure-pod-container/assign-pods-nodes/#add-a-label-to-a-node).
69+
-->
70+
- 有关常见标签的列表,请参阅[众所周知的标签、注释和污点](/zh-cn/docs/reference/labels-annotations-taints/)
71+
- 了解如何[向节点添加标签](/zh-cn/docs/tasks/configure-pod-container/assign-pods-nodes/#add-a-label-to-a-node)

content/zh-cn/docs/tasks/administer-cluster/namespaces.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,35 @@ List the current namespaces in a cluster using:
4949
kubectl get namespaces
5050
```
5151
```console
52-
NAME STATUS AGE
53-
default Active 11d
54-
kube-system Active 11d
55-
kube-public Active 11d
52+
NAME STATUS AGE
53+
default Active 11d
54+
kube-node-lease Active 11d
55+
kube-public Active 11d
56+
kube-system Active 11d
5657
```
5758

5859
<!--
59-
Kubernetes starts with three initial namespaces:
60+
Kubernetes starts with four initial namespaces:
6061
-->
61-
初始状态下,Kubernetes 具有三个名字空间
62+
初始状态下,Kubernetes 具有四个名字空间
6263

6364
<!--
6465
* `default` The default namespace for objects with no other namespace
65-
* `kube-system` The namespace for objects created by the Kubernetes system
66+
* `kube-node-lease` This namespace holds [Lease](/docs/concepts/architecture/leases/) 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.
6667
* `kube-public` This namespace is created automatically and is readable by all users
6768
(including those not authenticated). This namespace is mostly reserved for cluster usage,
6869
in case that some resources should be visible and readable publicly throughout the whole cluster.
6970
The public aspect of this namespace is only a convention, not a requirement.
71+
* `kube-system` The namespace for objects created by the Kubernetes system
7072
-->
7173
* `default` 无名字空间对象的默认名字空间
72-
* `kube-system` 由 Kubernetes 系统创建的对象的名字空间
74+
* `kube-node-lease` 此名字空间保存与每个节点关联的[租约(Lease)](/zh-cn/docs/concepts/architecture/leases/)对象。
75+
节点租约允许 kubelet 发送[心跳](/zh-cn/docs/concepts/architecture/nodes/#heartbeats),
76+
以便控制平面可以检测节点故障。
7377
* `kube-public` 自动创建且被所有用户可读的名字空间(包括未经身份认证的)。
7478
此名字空间通常在某些资源在整个集群中可见且可公开读取时被集群使用。
7579
此名字空间的公共方面只是一个约定,而不是一个必要条件。
80+
* `kube-system` 由 Kubernetes 系统创建的对象的名字空间
7681

7782
<!--
7883
You can also get the summary of a specific namespace using:

content/zh-cn/docs/tasks/configure-pod-container/assign-cpu-resource.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ in the Container resource manifest. To specify a CPU limit, include `resources:l
9797
In this exercise, you create a Pod that has one container. The container has a request
9898
of 0.5 CPU and a limit of 1 CPU. Here is the configuration file for the Pod:
9999
100-
{{< codenew file="pods/resource/cpu-request-limit.yaml" >}}
100+
{{% code file="pods/resource/cpu-request-limit.yaml" %}}
101101
102102
The `args` section of the configuration file provides arguments for the container when it starts.
103103
The `-cpus "2"` argument tells the Container to attempt to use 2 CPUs.
@@ -112,7 +112,7 @@ Create the Pod:
112112
在本练习中,你将创建一个具有一个容器的 Pod。容器将会请求 0.5 个 CPU,而且最多限制使用 1 个 CPU。
113113
这是 Pod 的配置文件:
114114

115-
{{< codenew file="pods/resource/cpu-request-limit.yaml" >}}
115+
{{% code file="pods/resource/cpu-request-limit.yaml" %}}
116116

117117
配置文件的 `args` 部分提供了容器启动时的参数。
118118
`-cpus "2"` 参数告诉容器尝试使用 2 个 CPU。
@@ -250,7 +250,7 @@ the capacity of any Node in your cluster. Here is the configuration file for a P
250250
that has one Container. The Container requests 100 CPU, which is likely to exceed the
251251
capacity of any Node in your cluster.
252252
253-
{{< codenew file="pods/resource/cpu-request-limit-2.yaml" >}}
253+
{{% code file="pods/resource/cpu-request-limit-2.yaml" %}}
254254
255255
Create the Pod:
256256
-->

content/zh-cn/docs/tasks/configure-pod-container/security-context.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Here is a configuration file for a Pod that has a `securityContext` and an `empt
108108
对象。你为 Pod 所设置的安全性配置会应用到 Pod 中所有 Container 上。
109109
下面是一个 Pod 的配置文件,该 Pod 定义了 `securityContext` 和一个 `emptyDir` 卷:
110110

111-
{{% codenew file="pods/security/security-context.yaml" %}}
111+
{{% code file="pods/security/security-context.yaml" %}}
112112

113113
<!--
114114
In the configuration file, the `runAsUser` field specifies that for any Containers in
@@ -371,7 +371,7 @@ Pod 层面设置的内容发生重叠时,会重写 Pod 层面的设置。Conta
371371
下面是一个 Pod 的配置文件,其中包含一个 Container。Pod 和 Container 都有
372372
`securityContext` 字段:
373373

374-
{{% codenew file="pods/security/security-context-2.yaml" %}}
374+
{{% code file="pods/security/security-context-2.yaml" %}}
375375

376376
<!--
377377
Create the Pod:
@@ -454,7 +454,7 @@ Here is configuration file that does not add or remove any Container capabilitie
454454
首先,看一下不包含 `capabilities` 字段时候会发生什么。
455455
下面是一个配置文件,其中没有添加或移除容器的权能:
456456

457-
{{% codenew file="pods/security/security-context-3.yaml" %}}
457+
{{% code file="pods/security/security-context-3.yaml" %}}
458458

459459
<!--
460460
Create the Pod:
@@ -546,7 +546,7 @@ adds the `CAP_NET_ADMIN` and `CAP_SYS_TIME` capabilities:
546546
下面是一个 Pod 的配置,其中运行一个容器。配置为容器添加 `CAP_NET_ADMIN`
547547
`CAP_SYS_TIME` 权能:
548548

549-
{{% codenew file="pods/security/security-context-4.yaml" %}}
549+
{{% code file="pods/security/security-context-4.yaml" %}}
550550

551551
<!--
552552
Create the Pod:
@@ -872,4 +872,3 @@ kubectl delete pod security-context-demo-4
872872
* [AllowPrivilegeEscalation 的设计文档(英文)](https://github.com/kubernetes/design-proposals-archive/blob/main/auth/no-new-privs.md)
873873
* 关于在 Linux 系统中的安全机制的更多信息,可参阅
874874
[Linux 内核安全性能力概述](https://www.linux.com/learn/overview-linux-kernel-security-features)(注意:部分信息已过时)。
875-

0 commit comments

Comments
 (0)