[zh-cn] sync managing-secret-using-kustomize manage-resources/assign-* configure-pod-container/memory-*|cpu-*

Signed-off-by: xin.li <xin.li@daocloud.io>
This commit is contained in:
xin.li 2023-09-10 12:46:38 +08:00
parent 18568296df
commit a6078e475d
9 changed files with 68 additions and 36 deletions

View File

@ -74,7 +74,7 @@ Here's a manifest for an example {{< glossary_tooltip text="LimitRange" term_id=
以下为 {{< glossary_tooltip text="LimitRange" term_id="limitrange" >}} 的示例清单: 以下为 {{< glossary_tooltip text="LimitRange" term_id="limitrange" >}} 的示例清单:
{{% code file="admin/resource/cpu-constraints.yaml" %}} {{% code_sample file="admin/resource/cpu-constraints.yaml" %}}
<!-- <!--
Create the LimitRange: Create the LimitRange:
@ -142,8 +142,8 @@ or GPUs as well. However, when both `default` and `defaultRequest` are specified
on these resources, the two values must be the same. on these resources, the two values must be the same.
--> -->
{{< note >}} {{< note >}}
当创建 LimitRange 对象时,你也可以声明大页面和 GPU 的限制。 当创建 `LimitRange` 对象时,你也可以声明大页面和 GPU 的限制。
当这些资源同时声明了 'default' 和 'defaultRequest' 参数时,两个参数值必须相同。 当这些资源同时声明了 `default``defaultRequest` 参数时,两个参数值必须相同。
{{< /note >}} {{< /note >}}
<!-- <!--
@ -155,7 +155,7 @@ minimum and maximum CPU constraints imposed by the LimitRange for this namespace
该容器声明了 CPU 请求 500 millicpu 和 CPU 限制 800 millicpu。 该容器声明了 CPU 请求 500 millicpu 和 CPU 限制 800 millicpu。
这些参数满足了 LimitRange 对象为此名字空间规定的 CPU 最小和最大限制。 这些参数满足了 LimitRange 对象为此名字空间规定的 CPU 最小和最大限制。
{{% code file="admin/resource/cpu-constraints-pod.yaml" %}} {{% code_sample file="admin/resource/cpu-constraints-pod.yaml" %}}
<!-- <!--
Create the Pod: Create the Pod:
@ -219,7 +219,7 @@ CPU request of 500 millicpu and a cpu limit of 1.5 cpu.
这里给出了包含一个容器的 Pod 清单。容器声明了 500 millicpu 的 CPU 这里给出了包含一个容器的 Pod 清单。容器声明了 500 millicpu 的 CPU
请求和 1.5 CPU 的 CPU 限制。 请求和 1.5 CPU 的 CPU 限制。
{{% code file="admin/resource/cpu-constraints-pod-2.yaml" %}} {{% code_sample file="admin/resource/cpu-constraints-pod-2.yaml" %}}
<!-- <!--
Attempt to create the Pod: Attempt to create the Pod:
@ -252,7 +252,7 @@ CPU request of 100 millicpu and a CPU limit of 800 millicpu.
以下为某个只有一个容器的 Pod 的清单。该容器声明了 CPU 请求 100 millicpu 和 CPU 限制 800 millicpu。 以下为某个只有一个容器的 Pod 的清单。该容器声明了 CPU 请求 100 millicpu 和 CPU 限制 800 millicpu。
{{% code file="admin/resource/cpu-constraints-pod-3.yaml" %}} {{% code_sample file="admin/resource/cpu-constraints-pod-3.yaml" %}}
<!-- <!--
Attempt to create the Pod: Attempt to create the Pod:
@ -286,7 +286,7 @@ specify a CPU request, nor does it specify a CPU limit.
以下为一个只有一个容器的 Pod 的清单。该容器没有声明 CPU 请求,也没有声明 CPU 限制。 以下为一个只有一个容器的 Pod 的清单。该容器没有声明 CPU 请求,也没有声明 CPU 限制。
{{% code file="admin/resource/cpu-constraints-pod-4.yaml" %}} {{% code_sample file="admin/resource/cpu-constraints-pod-4.yaml" %}}
<!-- <!--
Create the Pod: Create the Pod:

View File

@ -79,7 +79,7 @@ The manifest specifies a default CPU request and a default CPU limit.
以下为 {{< glossary_tooltip text="LimitRange" term_id="limitrange" >}} 的示例清单。 以下为 {{< glossary_tooltip text="LimitRange" term_id="limitrange" >}} 的示例清单。
清单中声明了默认 CPU 请求和默认 CPU 限制。 清单中声明了默认 CPU 请求和默认 CPU 限制。
{{% code file="admin/resource/cpu-defaults.yaml" %}} {{% code_sample file="admin/resource/cpu-defaults.yaml" %}}
<!-- <!--
Create the LimitRange in the default-cpu-example namespace: Create the LimitRange in the default-cpu-example namespace:
@ -105,7 +105,7 @@ does not specify a CPU request and limit.
以下为只包含一个容器的 Pod 的清单。该容器没有声明 CPU 请求和限制。 以下为只包含一个容器的 Pod 的清单。该容器没有声明 CPU 请求和限制。
{{% code file="admin/resource/cpu-defaults-pod.yaml" %}} {{% code_sample file="admin/resource/cpu-defaults-pod.yaml" %}}
<!-- <!--
Create the Pod. Create the Pod.
@ -155,7 +155,7 @@ specifies a CPU limit, but not a request:
以下为只包含一个容器的 Pod 的清单。该容器声明了 CPU 限制,而没有声明 CPU 请求。 以下为只包含一个容器的 Pod 的清单。该容器声明了 CPU 限制,而没有声明 CPU 请求。
{{% code file="admin/resource/cpu-defaults-pod-2.yaml" %}} {{% code_sample file="admin/resource/cpu-defaults-pod-2.yaml" %}}
<!-- <!--
Create the Pod: Create the Pod:
@ -200,7 +200,7 @@ specifies a CPU request, but not a limit:
这里给出了包含一个容器的 Pod 的示例清单。该容器声明了 CPU 请求,而没有声明 CPU 限制。 这里给出了包含一个容器的 Pod 的示例清单。该容器声明了 CPU 请求,而没有声明 CPU 限制。
{{% code file="admin/resource/cpu-defaults-pod-3.yaml" %}} {{% code_sample file="admin/resource/cpu-defaults-pod-3.yaml" %}}
<!-- <!--
Create the Pod: Create the Pod:

View File

@ -66,7 +66,7 @@ Here's an example manifest for a LimitRange:
下面是 LimitRange 的示例清单: 下面是 LimitRange 的示例清单:
{{% code file="admin/resource/memory-constraints.yaml" %}} {{% code_sample file="admin/resource/memory-constraints.yaml" %}}
<!-- <!--
Create the LimitRange: Create the LimitRange:
@ -132,7 +132,7 @@ minimum and maximum memory constraints imposed by the LimitRange.
以下为包含一个容器的 Pod 清单。该容器声明了 600 MiB 的内存请求和 800 MiB 的内存限制, 以下为包含一个容器的 Pod 清单。该容器声明了 600 MiB 的内存请求和 800 MiB 的内存限制,
这些满足了 LimitRange 施加的最小和最大内存约束。 这些满足了 LimitRange 施加的最小和最大内存约束。
{{% code file="admin/resource/memory-constraints-pod.yaml" %}} {{% code_sample file="admin/resource/memory-constraints-pod.yaml" %}}
<!-- <!--
Create the Pod: Create the Pod:
@ -196,7 +196,7 @@ memory request of 800 MiB and a memory limit of 1.5 GiB.
以下为包含一个容器的 Pod 的清单。这个容器声明了 800 MiB 的内存请求和 1.5 GiB 的内存限制。 以下为包含一个容器的 Pod 的清单。这个容器声明了 800 MiB 的内存请求和 1.5 GiB 的内存限制。
{{% code file="admin/resource/memory-constraints-pod-2.yaml" %}} {{% code_sample file="admin/resource/memory-constraints-pod-2.yaml" %}}
<!-- <!--
Attempt to create the Pod: Attempt to create the Pod:
@ -228,7 +228,7 @@ memory request of 100 MiB and a memory limit of 800 MiB.
以下为只有一个容器的 Pod 的清单。这个容器声明了 100 MiB 的内存请求和 800 MiB 的内存限制。 以下为只有一个容器的 Pod 的清单。这个容器声明了 100 MiB 的内存请求和 800 MiB 的内存限制。
{{% code file="admin/resource/memory-constraints-pod-3.yaml" %}} {{% code_sample file="admin/resource/memory-constraints-pod-3.yaml" %}}
<!-- <!--
Attempt to create the Pod: Attempt to create the Pod:
@ -260,7 +260,7 @@ specify a memory request, and it does not specify a memory limit.
以下为只有一个容器的 Pod 清单。该容器没有声明内存请求,也没有声明内存限制。 以下为只有一个容器的 Pod 清单。该容器没有声明内存请求,也没有声明内存限制。
{{% code file="admin/resource/memory-constraints-pod-4.yaml" %}} {{% code_sample file="admin/resource/memory-constraints-pod-4.yaml" %}}
<!-- <!--
Create the Pod: Create the Pod:

View File

@ -81,7 +81,7 @@ request and a default memory limit.
以下为 {{< glossary_tooltip text="LimitRange" term_id="limitrange" >}} 的示例清单。 以下为 {{< glossary_tooltip text="LimitRange" term_id="limitrange" >}} 的示例清单。
清单中声明了默认的内存请求和默认的内存限制。 清单中声明了默认的内存请求和默认的内存限制。
{{% code file="admin/resource/memory-defaults.yaml" %}} {{% code_sample file="admin/resource/memory-defaults.yaml" %}}
<!-- <!--
Create the LimitRange in the default-mem-example namespace: Create the LimitRange in the default-mem-example namespace:
@ -108,7 +108,7 @@ does not specify a memory request and limit.
以下为只包含一个容器的 Pod 的清单。该容器没有声明内存请求和限制。 以下为只包含一个容器的 Pod 的清单。该容器没有声明内存请求和限制。
{{% code file="admin/resource/memory-defaults-pod.yaml" %}} {{% code_sample file="admin/resource/memory-defaults-pod.yaml" %}}
<!-- <!--
Create the Pod. Create the Pod.
@ -166,7 +166,7 @@ specifies a memory limit, but not a request:
以下为只包含一个容器的 Pod 的清单。该容器声明了内存限制,而没有声明内存请求。 以下为只包含一个容器的 Pod 的清单。该容器声明了内存限制,而没有声明内存请求。
{{% code file="admin/resource/memory-defaults-pod-2.yaml" %}} {{% code_sample file="admin/resource/memory-defaults-pod-2.yaml" %}}
<!-- <!--
Create the Pod: Create the Pod:
@ -211,7 +211,7 @@ specifies a memory request, but not a limit:
--> -->
以下为只包含一个容器的 Pod 的清单。该容器声明了内存请求,但没有内存限制: 以下为只包含一个容器的 Pod 的清单。该容器声明了内存请求,但没有内存限制:
{{% code file="admin/resource/memory-defaults-pod-3.yaml" %}} {{% code_sample file="admin/resource/memory-defaults-pod-3.yaml" %}}
<!-- <!--
Create the Pod: Create the Pod:

View File

@ -139,14 +139,47 @@ When a Secret is generated, the Secret name is created by hashing
the Secret data and appending the hash value to the name. This ensures that the Secret data and appending the hash value to the name. This ensures that
a new Secret is generated each time the data is modified. a new Secret is generated each time the data is modified.
To verify that the Secret was created and to decode the Secret data, refer to To verify that the Secret was created and to decode the Secret data,
[Managing Secrets using kubectl](/docs/tasks/configmap-secret/managing-secret-using-kubectl/#verify-the-secret).
--> -->
生成 Secret 时Secret 的名称最终是由 `name` 字段和数据的哈希值拼接而成。 生成 Secret 时Secret 的名称最终是由 `name` 字段和数据的哈希值拼接而成。
这将保证每次修改数据时生成一个新的 Secret。 这将保证每次修改数据时生成一个新的 Secret。
要验证 Secret 是否已创建并解码 Secret 数据, 要验证 Secret 是否已创建并解码 Secret 数据,
请参阅[使用 kubectl 管理 Secret](/zh-cn/docs/tasks/configmap-secret/managing-secret-using-kubectl/#verify-the-secret)。
```shell
kubectl get -k <directory-path> -o jsonpath='{.data}'
```
<!--
The output is similar to:
-->
输出类似于:
```
{ "password": "UyFCXCpkJHpEc2I9", "username": "YWRtaW4=" }
````
```
echo 'UyFCXCpkJHpEc2I9' | base64 --decode
```
<!--
The output is similar to:
-->
输出类似于:
```
S!B\*d$zDsb=
```
<!--
For more information, refer to
[Managing Secrets using kubectl](/docs/tasks/configmap-secret/managing-secret-using-kubectl/#verify-the-secret) and
[Declarative Management of Kubernetes Objects Using Kustomize](/docs/tasks/manage-kubernetes-objects/kustomization/).
-->
更多信息参阅
[使用 kubectl 管理 Secret](/zh-cn/docs/tasks/configmap-secret/managing-secret-using-kubectl/#verify-the-secret)和
[使用 Kustomize 对 Kubernetes 对象进行声明式管理](/zh-cn/docs/tasks/manage-kubernetes-objects/kustomization/)
<!-- <!--
## Edit a Secret {#edit-secret} ## Edit a Secret {#edit-secret}

View File

@ -97,7 +97,7 @@ in the Container resource manifest. To specify a CPU limit, include `resources:l
In this exercise, you create a Pod that has one container. The container has a request In this exercise, you create a Pod that has one container. The container has a request
of 0.5 CPU and a limit of 1 CPU. Here is the configuration file for the Pod: of 0.5 CPU and a limit of 1 CPU. Here is the configuration file for the Pod:
{{% code file="pods/resource/cpu-request-limit.yaml" %}} {{% code_sample file="pods/resource/cpu-request-limit.yaml" %}}
The `args` section of the configuration file provides arguments for the container when it starts. The `args` section of the configuration file provides arguments for the container when it starts.
The `-cpus "2"` argument tells the Container to attempt to use 2 CPUs. The `-cpus "2"` argument tells the Container to attempt to use 2 CPUs.
@ -112,7 +112,7 @@ Create the Pod:
在本练习中,你将创建一个具有一个容器的 Pod。容器将会请求 0.5 个 CPU而且最多限制使用 1 个 CPU。 在本练习中,你将创建一个具有一个容器的 Pod。容器将会请求 0.5 个 CPU而且最多限制使用 1 个 CPU。
这是 Pod 的配置文件: 这是 Pod 的配置文件:
{{% code file="pods/resource/cpu-request-limit.yaml" %}} {{% code_sample file="pods/resource/cpu-request-limit.yaml" %}}
配置文件的 `args` 部分提供了容器启动时的参数。 配置文件的 `args` 部分提供了容器启动时的参数。
`-cpus "2"` 参数告诉容器尝试使用 2 个 CPU。 `-cpus "2"` 参数告诉容器尝试使用 2 个 CPU。
@ -250,7 +250,7 @@ the capacity of any Node in your cluster. Here is the configuration file for a P
that has one Container. The Container requests 100 CPU, which is likely to exceed the that has one Container. The Container requests 100 CPU, which is likely to exceed the
capacity of any Node in your cluster. capacity of any Node in your cluster.
{{% code file="pods/resource/cpu-request-limit-2.yaml" %}} {{% code_sample file="pods/resource/cpu-request-limit-2.yaml" %}}
Create the Pod: Create the Pod:
--> -->
@ -266,7 +266,7 @@ Pod 调度是基于资源请求值来进行的。
在本练习中,你将创建一个 Pod该 Pod 的 CPU 请求对于集群中任何节点的容量而言都会过大。 在本练习中,你将创建一个 Pod该 Pod 的 CPU 请求对于集群中任何节点的容量而言都会过大。
下面是 Pod 的配置文件,其中有一个容器。容器请求 100 个 CPU这可能会超出集群中任何节点的容量。 下面是 Pod 的配置文件,其中有一个容器。容器请求 100 个 CPU这可能会超出集群中任何节点的容量。
{{< codenew file="pods/resource/cpu-request-limit-2.yaml" >}} {{% code_sample file="pods/resource/cpu-request-limit-2.yaml" %}}
创建 Pod 创建 Pod

View File

@ -105,7 +105,7 @@ for the Pod:
容器将会请求 100 MiB 内存,并且内存会被限制在 200 MiB 以内。 容器将会请求 100 MiB 内存,并且内存会被限制在 200 MiB 以内。
这是 Pod 的配置文件: 这是 Pod 的配置文件:
{{% code file="pods/resource/memory-request-limit.yaml" %}} {{% code_sample file="pods/resource/memory-request-limit.yaml" %}}
<!-- <!--
The `args` section in the configuration file provides arguments for the Container when it starts. The `args` section in the configuration file provides arguments for the Container when it starts.
@ -212,7 +212,7 @@ memory request of 50 MiB and a memory limit of 100 MiB:
在本练习中,你将创建一个 Pod尝试分配超出其限制的内存。 在本练习中,你将创建一个 Pod尝试分配超出其限制的内存。
这是一个 Pod 的配置文件,其拥有一个容器,该容器的内存请求为 50 MiB内存限制为 100 MiB 这是一个 Pod 的配置文件,其拥有一个容器,该容器的内存请求为 50 MiB内存限制为 100 MiB
{{% code file="pods/resource/memory-request-limit-2.yaml" %}} {{% code_sample file="pods/resource/memory-request-limit-2.yaml" %}}
<!-- <!--
In the `args` section of the configuration file, you can see that the Container In the `args` section of the configuration file, you can see that the Container
@ -338,7 +338,7 @@ Warning OOMKilling Memory cgroup out of memory: Kill process 4481 (stress) score
<!-- <!--
Delete your Pod: Delete your Pod:
--> -->
删除 Pod: 删除 Pod
```shell ```shell
kubectl delete pod memory-demo-2 --namespace=mem-example kubectl delete pod memory-demo-2 --namespace=mem-example
@ -372,7 +372,7 @@ Pod 的调度基于请求。只有当节点拥有足够满足 Pod 内存请求
在本练习中,你将创建一个 Pod其内存请求超过了你集群中的任意一个节点所拥有的内存。 在本练习中,你将创建一个 Pod其内存请求超过了你集群中的任意一个节点所拥有的内存。
这是该 Pod 的配置文件,其拥有一个请求 1000 GiB 内存的容器,这应该超过了你集群中任何节点的容量。 这是该 Pod 的配置文件,其拥有一个请求 1000 GiB 内存的容器,这应该超过了你集群中任何节点的容量。
{{% code file="pods/resource/memory-request-limit-3.yaml" %}} {{% code_sample file="pods/resource/memory-request-limit-3.yaml" %}}
<!-- <!--
Create the Pod: Create the Pod:

View File

@ -109,7 +109,7 @@ This means that the pod will get scheduled only on a node that has a `disktype=s
下面清单描述了一个 Pod它有一个节点亲和性配置 `requiredDuringSchedulingIgnoredDuringExecution``disktype=ssd`。 下面清单描述了一个 Pod它有一个节点亲和性配置 `requiredDuringSchedulingIgnoredDuringExecution``disktype=ssd`。
这意味着 pod 只会被调度到具有 `disktype=ssd` 标签的节点上。 这意味着 pod 只会被调度到具有 `disktype=ssd` 标签的节点上。
{{% code file="pods/pod-nginx-required-affinity.yaml" %}} {{% code_sample file="pods/pod-nginx-required-affinity.yaml" %}}
<!-- <!--
1. Apply the manifest to create a Pod that is scheduled onto your 1. Apply the manifest to create a Pod that is scheduled onto your
@ -152,7 +152,7 @@ This means that the pod will prefer a node that has a `disktype=ssd` label.
本清单描述了一个 Pod它有一个节点亲和性设置 `preferredDuringSchedulingIgnoredDuringExecution``disktype: ssd`。 本清单描述了一个 Pod它有一个节点亲和性设置 `preferredDuringSchedulingIgnoredDuringExecution``disktype: ssd`。
这意味着 Pod 将首选具有 `disktype=ssd` 标签的节点。 这意味着 Pod 将首选具有 `disktype=ssd` 标签的节点。
{{% code file="pods/pod-nginx-preferred-affinity.yaml" %}} {{% code_sample file="pods/pod-nginx-preferred-affinity.yaml" %}}
<!-- <!--
1. Apply the manifest to create a Pod that is scheduled onto your 1. Apply the manifest to create a Pod that is scheduled onto your

View File

@ -100,7 +100,7 @@ a `disktype=ssd` label.
此 Pod 配置文件描述了一个拥有节点选择器 `disktype: ssd` 的 Pod。这表明该 Pod 此 Pod 配置文件描述了一个拥有节点选择器 `disktype: ssd` 的 Pod。这表明该 Pod
将被调度到有 `disktype=ssd` 标签的节点。 将被调度到有 `disktype=ssd` 标签的节点。
{{% codenew file="pods/pod-nginx.yaml" %}} {{% code_sample file="pods/pod-nginx.yaml" %}}
<!-- <!--
1. Use the configuration file to create a pod that will get scheduled on your 1. Use the configuration file to create a pod that will get scheduled on your
@ -140,7 +140,7 @@ You can also schedule a pod to one specific node via setting `nodeName`.
你也可以通过设置 `nodeName` 将某个 Pod 调度到特定的节点。 你也可以通过设置 `nodeName` 将某个 Pod 调度到特定的节点。
{{% codenew file="pods/pod-nginx-specific-node.yaml" %}} {{% code_sample file="pods/pod-nginx-specific-node.yaml" %}}
<!-- <!--
Use the configuration file to create a pod that will get scheduled on `foo-node` only. Use the configuration file to create a pod that will get scheduled on `foo-node` only.
@ -155,4 +155,3 @@ Use the configuration file to create a pod that will get scheduled on `foo-node`
--> -->
* 进一步了解[标签和选择算符](/zh-cn/docs/concepts/overview/working-with-objects/labels/) * 进一步了解[标签和选择算符](/zh-cn/docs/concepts/overview/working-with-objects/labels/)
* 进一步了解[节点](/zh-cn/docs/concepts/architecture/nodes/) * 进一步了解[节点](/zh-cn/docs/concepts/architecture/nodes/)