[zh] sync manage-resources/*.md

Signed-off-by: song <tinysong1226@gmail.com>
This commit is contained in:
song
2022-05-14 21:50:52 +08:00
parent 16e11b248a
commit 37dd442dfa
2 changed files with 180 additions and 107 deletions
@@ -2,6 +2,8 @@
title: 为命名空间配置默认的 CPU 请求和限制
content_type: task
weight: 20
description: >-
为命名空间定义默认的 CPU 资源限制,在该命名空间中每个新建的 Pod 都会被配置上 CPU 资源限制。
---
<!--
@@ -12,20 +14,44 @@ weight: 20
<!-- overview -->
<!--
This page shows how to configure default CPU requests and limits for a namespace.
A Kubernetes cluster can be divided into namespaces. If a Container is created in a namespace
that has a default CPU limit, and the Container does not specify its own CPU limit, then
the Container is assigned the default CPU limit. Kubernetes assigns a default CPU request
under certain conditions that are explained later in this topic.
This page shows how to configure default CPU requests and limits for a
{{< glossary_tooltip text="namespace" term_id="namespace" >}}.
A Kubernetes cluster can be divided into namespaces. If you create a Pod within a
namespace that has a default CPU
[limit](/docs/concepts/configuration/manage-resources-containers/#requests-and-limits), and any container in that Pod does not specify
its own CPU limit, then the
{{< glossary_tooltip text="control plane" term_id="control-plane" >}} assigns the default
CPU limit to that container.
Kubernetes assigns a default CPU
[request](/docs/concepts/configuration/manage-resources-containers/#requests-and-limits),
but only under certain conditions that are explained later in this page.
-->
本章介绍怎样为命名空间配置默认的 CPU 请求和限制。
一个 Kubernetes 集群可被划分为多个命名空间。如果在配置了 CPU 限制的命名空间创建容器,
并且该容器没有声明自己的 CPU 限制,那么这个容器会被指定默认的 CPU 限制
Kubernetes 在一些特定情况还会指定 CPU 请求,本文后续章节将会对其进行解释。
本章介绍如何为{{< glossary_tooltip text="命名空间" term_id="namespace" >}}配置默认的 CPU 请求和限制。
一个 Kubernetes 集群可被划分为多个命名空间
如果你在具有默认 CPU[限制](/zh/docs/concepts/configuration/manage-resources-containers/#requests-and-limits)
的命名空间内创建一个 Pod,并且这个 Pod 中任何容器都没有声明自己的 CPU 限制,
那么{{< glossary_tooltip text="控制面" term_id="control-plane" >}}会为容器设定默认的 CPU 限制。
Kubernetes 在一些特定情况还可以设置默认的 CPU 请求,本文后续章节将会对其进行解释。
## {{% heading "prerequisites" %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
{{< include "task-tutorial-prereqs.md" >}}
<!--
You must have access to create namespaces in your cluster.
If you're not already familiar with what Kubernetes means by 1.0 CPU,
read [meaning of CPU](/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu).
-->
在你的集群里你必须要有创建命名空间的权限。
如果你还不熟悉 Kubernetes 中 1.0 CPU 的含义,
请阅读 [CPU 的含义](/zh/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu)。
<!-- steps -->
@@ -46,12 +72,13 @@ kubectl create namespace default-cpu-example
<!--
## Create a LimitRange and a Pod
Here's the configuration file for a LimitRange object. The configuration specifies
a default CPU request and a default CPU limit.
Here's a manifest for an example {{< glossary_tooltip text="LimitRange" term_id="limitrange" >}}.
The manifest specifies a default CPU request and a default CPU limit.
-->
## 创建 LimitRange 和 Pod
这里给出了 LimitRange 对象的配置文件。该配置声明了一个默认的 CPU 请求和一个默认的 CPU 限制
以下为 {{< glossary_tooltip text="LimitRange" term_id="limitrange" >}} 的示例清单
清单中声明了默认 CPU 请求和默认 CPU 限制。
{{< codenew file="admin/resource/cpu-defaults.yaml" >}}
@@ -65,18 +92,19 @@ kubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults.yaml --name
```
<!--
Now if a Container is created in the default-cpu-example namespace, and the
Container does not specify its own values for CPU request and CPU limit,
the Container is given a default CPU request of 0.5 and a default
Now if you create a Pod in the default-cpu-example namespace, and any container
in that Pod does not specify its own values for CPU request and CPU limit,
then the control plane applies default values: a CPU request of 0.5 and a default
CPU limit of 1.
Here's the configuration file for a Pod that has one Container. The Container
Here's a manifest for a Pod that has one container. The container
does not specify a CPU request and limit.
-->
现在如果在 default-cpu-example 命名空间创建一个容器,该容器没有声明自己的 CPU 请求和限制时
将会给它指定默认的 CPU 请求0.5和默认的 CPU 限制值1.
现在如果在 default-cpu-example 命名空间创建一个 Pod
并且该 Pod 中所有容器都没有声明自己的 CPU 请求 CPU 限制
控制面会将 CPU 的默认请求值 0.5 和默认限制值 1 应用到 Pod 上。
这里给出了包含一个容器的 Pod 的配置文件。该容器没有声明 CPU 请求和限制。
以下为只包含一个容器的 Pod 的清单。该容器没有声明 CPU 请求和限制。
{{< codenew file="admin/resource/cpu-defaults-pod.yaml" >}}
@@ -99,10 +127,12 @@ kubectl get pod default-cpu-demo --output=yaml --namespace=default-cpu-example
```
<!--
The output shows that the Pod's Container has a CPU request of 500 millicpus and
a CPU limit of 1 cpu. These are the default values specified by the LimitRange.
The output shows that the Pod's only container has a CPU request of 500m `cpu`
(which you can read as “500 millicpu”), and a CPU limit of 1 `cpu`.
These are the default values specified by the LimitRange.
-->
输出显示该 Pod 的容器有一个500 millicpus的 CPU 请求和一个1 cpu的 CPU 限制。这些是 LimitRange 声明的默认值
输出显示该 Pod 的唯一的容器有 500m `cpu` 的 CPU 请求和 1 `cpu` 的 CPU 限制
这些是 LimitRange 声明的默认值。
```shell
containers:
@@ -117,14 +147,14 @@ containers:
```
<!--
## What if you specify a Container's limit, but not its request?
## What if you specify a container's limit, but not its request?
Here's the configuration file for a Pod that has one Container. The Container
Here's a manifest for a Pod that has one container. The container
specifies a CPU limit, but not a request:
-->
## 你只声明容器的限制,而不声明请求会怎么样?
这是包含一个容器的 Pod 的配置文件。该容器声明了 CPU 限制,而没有声明 CPU 请求。
以下为只包含一个容器的 Pod 的清单。该容器声明了 CPU 限制,而没有声明 CPU 请求。
{{< codenew file="admin/resource/cpu-defaults-pod-2.yaml" >}}
@@ -138,9 +168,10 @@ kubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod-2.yaml
```
<!--
View the Pod specification:
View the [specification](/docs/concepts/overview/working-with-objects/kubernetes-objects/#object-spec-and-status)
of the Pod that you created:
-->
查看 Pod 的声明
查看你所创建的 Pod 的[规约](/zh/docs/concepts/overview/working-with-objects/kubernetes-objects/#object-spec-and-status)
```
kubectl get pod default-cpu-demo-2 --output=yaml --namespace=default-cpu-example
@@ -148,9 +179,9 @@ kubectl get pod default-cpu-demo-2 --output=yaml --namespace=default-cpu-example
<!--
The output shows that the Container's CPU request is set to match its CPU limit.
Notice that the Container was not assigned the default CPU request value of 0.5 cpu.
Notice that the container was not assigned the default CPU request value of 0.5 `cpu`:
-->
输出显示该容器的 CPU 请求和 CPU 限制设置相同。注意该容器没有被指定默认的 CPU 请求值0.5 cpu
输出显示该容器的 CPU 请求和 CPU 限制设置相同。注意该容器没有被指定默认的 CPU 请求值 0.5 `cpu`
```
resources:
@@ -161,14 +192,14 @@ resources:
```
<!--
## What if you specify a Container's request, but not its limit?
## What if you specify a container's request, but not its limit?
Here's the configuration file for a Pod that has one Container. The Container
Here's an example manifest for a Pod that has one container. The container
specifies a CPU request, but not a limit:
-->
## 你只声明容器的请求,而不声明它的限制会怎么样?
这里给出了包含一个容器的 Pod 的配置文件。该容器声明了 CPU 请求,而没有声明 CPU 限制。
这里给出了包含一个容器的 Pod 的示例清单。该容器声明了 CPU 请求,而没有声明 CPU 限制。
{{< codenew file="admin/resource/cpu-defaults-pod-3.yaml" >}}
@@ -182,21 +213,22 @@ kubectl apply -f https://k8s.io/examples/admin/resource/cpu-defaults-pod-3.yaml
```
<!--
View the Pod specification:
View the specification of the Pod that you created:
-->
查看 Pod 的规约
查看所你创建的 Pod 的规约:
```
kubectl get pod default-cpu-demo-3 --output=yaml --namespace=default-cpu-example
```
<!--
The output shows that the Container's CPU request is set to the value specified in the
Container's configuration file. The Container's CPU limit is set to 1 cpu, which is the
default CPU limit for the namespace.
The output shows that the container's CPU request is set to the value you specified at
the time you created the Pod (in other words: it matches the manifest).
However, the same container's CPU limit is set to 1 `cpu`, which is the default CPU limit
for that namespace.
-->
结果显示该容器的 CPU 请求被设置为容器配置文件中声明的值。
容器的CPU限制被设置为 1 CPU,即该命名空间的默认 CPU 限制值。
输出显示你所创建的 Pod 中,容器的 CPU 请求为 Pod 清单中声明的值。
然而同一容器的 CPU 限制被设置为 1 `cpu`,此值是该命名空间的默认 CPU 限制值。
```
resources:
@@ -209,27 +241,41 @@ resources:
<!--
## Motivation for default CPU limits and requests
If your namespace has a
[resource quota](/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/),
If your namespace has a CPU {{< glossary_tooltip text="resource quota" term_id="resource-quota" >}}
configured,
it is helpful to have a default value in place for CPU limit.
Here are two of the restrictions that a resource quota imposes on a namespace:
Here are two of the restrictions that a CPU resource quota imposes on a namespace:
* Every Container that runs in the namespace must have its own CPU limit.
* The total amount of CPU used by all Containers in the namespace must not exceed a specified limit.
* For every Pod that runs in the namespace, each of its containers must have a CPU limit.
* CPU request apply a resource reservation on the node where the Pod in question is scheduled.
The total amount of CPU that is reserved for use by all Pods in the namespace must not
exceed a specified limit.
If a Container does not specify its own CPU limit, it is given the default limit, and then
it can be allowed to run in a namespace that is restricted by a quota.
-->
## 默认 CPU 限制和请求的动机
如果你的命名空间有一个
[资源配额](/zh/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/)
那么有一个默认的 CPU 限制是有帮助的。这里有资源配额强加给命名空间的两条限制:
如果你的命名空间设置了 CPU {{< glossary_tooltip text="资源配额" term_id="resource-quota" >}}
为 CPU 限制设置一个默认值会很有帮助。
以下是 CPU 资源配额命名空间的施加的两条限制:
* 命名空间中运行的每个容器必须有自己的 CPU 限制。
* 命名空间中所有容器使用的 CPU 总和不能超过一个声明值。
* 命名空间中运行的每个 Pod 中的容器必须有 CPU 限制。
如果容器没有声明自己的 CPU 限制,将会给它一个默认限制,这样它就能被允许运行在一个有配额限制的命名空间中
* CPU 限制用来在 Pod 被调度到的节点上执行资源预留
预留给命名空间中所有 Pod 使用的 CPU 总量不能超过规定的限制。
<!--
When you add a LimitRange:
If any Pod in that namespace that includes a container does not specify its own CPU limit,
the control plane applies the default CPU limit to that container, and the Pod can be
allowed to run in a namespace that is restricted by a CPU ResourceQuota.
-->
当你添加 LimitRange 时:
如果该命名空间中的任何 Pod 的容器未指定 CPU 限制,
控制面将默认 CPU 限制应用于该容器,
这样 Pod 可以在受到 CPU ResourceQuota 限制的命名空间中运行。
<!--
## Clean up
@@ -2,6 +2,8 @@
title: 配置命名空间的最小和最大内存约束
content_type: task
weight: 30
description: >-
为命名口空间定义一个有效的内存资源限制范围,在该命名空间中每个新创建 Pod 的内存资源是在设置的范围内。
---
<!--
@@ -13,7 +15,7 @@ weight: 30
<!-- overview -->
<!--
This page shows how to set minimum and maximum values for memory used by Containers
This page shows how to set minimum and maximum values for memory used by containers
running in a namespace. You specify minimum and maximum memory values in a
[LimitRange](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#limitrange-v1-core)
object. If a Pod does not meet the constraints imposed by the LimitRange,
@@ -25,12 +27,16 @@ it cannot be created in the namespace.
## {{% heading "prerequisites" %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
{{< include "task-tutorial-prereqs.md" >}}
<!--
Each node in your cluster must have at least 1 GiB of memory.
You must have access to create namespaces in your cluster.
Each node in your cluster must have at least 1 GiB of memory available for Pods.
-->
集群中每个节点必须至少要有 1 GiB 的内存
在你的集群里你必须要有创建命名空间的权限
集群中的每个节点都必须至少有 1 GiB 的内存可供 Pod 使用。
<!-- steps -->
@@ -51,11 +57,11 @@ kubectl create namespace constraints-mem-example
<!--
## Create a LimitRange and a Pod
Here's the configuration file for a LimitRange:
Here's an example manifest for a LimitRange:
-->
## 创建 LimitRange 和 Pod
下面是 LimitRange 的配置文件
下面是 LimitRange 的示例清单
{{< codenew file="admin/resource/memory-constraints.yaml" >}}
@@ -98,30 +104,31 @@ file for the LimitRange, they were created automatically.
```
<!--
Now whenever a Container is created in the constraints-mem-example namespace, Kubernetes
Now whenever you define a Pod within the constraints-mem-example namespace, Kubernetes
performs these steps:
* If the Container does not specify its own memory request and limit, assign the default
memory request and limit to the Container.
* If any container in that Pod does not specify its own memory request and limit, assign
the default memory request and limit to that container.
* Verify that the Container has a memory request that is greater than or equal to 500 MiB.
* Verify that every container in that Pod requests at least 500 MiB of memory.
* Verify that the Container has a memory limit that is less than or equal to 1 GiB.
* Verify that every container in that Pod requests no more than 1024 MiB (1 GiB)
of memory.
Here's the configuration file for a Pod that has one Container. The Container manifest
specifies a memory request of 600 MiB and a memory limit of 800 MiB. These satisfy the
Here's a manifest for a Pod that has one container. Within the Pod spec, the sole
container specifies a memory request of 600 MiB and a memory limit of 800 MiB. These satisfy the
minimum and maximum memory constraints imposed by the LimitRange.
-->
现在,只要在 constraints-mem-example 命名空间中创建容器Kubernetes 就会执行下面的步骤:
现在,每当在 constraints-mem-example 命名空间中创建 Pod 时Kubernetes 就会执行下面的步骤:
* 如果 Container 未指定自己的内存请求和限制,将为它指定默认的内存请求和限制。
* 如果 Pod 中的任何容器未声明自己的内存请求和限制,将为该容器设置默认的内存请求和限制。
* 验证 Container 的内存请求是否大于或等于500 MiB。
* 确保该 Pod 中的每个容器的内存请求至少 500 MiB。
* 验证 Container 的内存限制是否小于或等于1 GiB。
* 确保该 Pod 中每个容器内存请求不大于 1 GiB。
这里给出了包含一个 Container 的 Pod 配置文件。Container 声明了 600 MiB 的内存请求和
800 MiB 的内存限制, 这些满足了 LimitRange 施加的最小和最大内存约束。
以下为包含一个容器的 Pod 清单。该容器声明了 600 MiB 的内存请求和 800 MiB 的内存限制,
这些满足了 LimitRange 施加的最小和最大内存约束。
{{< codenew file="admin/resource/memory-constraints-pod.yaml" >}}
@@ -135,9 +142,9 @@ kubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod.y
```
<!--
Verify that the Pod's Container is running:
Verify that the Pod is running and that its container is healthy:
-->
确认 Pod 中的容器在运行
确认 Pod 正在运行,并且其容器处于健康状态
```shell
kubectl get pod constraints-mem-demo --namespace=constraints-mem-example
@@ -153,10 +160,12 @@ kubectl get pod constraints-mem-demo --output=yaml --namespace=constraints-mem-e
```
<!--
The output shows that the Container has a memory request of 600 MiB and a memory limit
of 800 MiB. These satisfy the constraints imposed by the LimitRange.
The output shows that the container within that Pod has a memory request of 600 MiB and
a memory limit of 800 MiB. These satisfy the constraints imposed by the LimitRange for
this namespace:
-->
输出结果显示容器的内存请求为600 MiB,内存限制为800 MiB。这些满足了 LimitRange 设定的限制范围。
输出结果显示该 Pod 的容器的内存请求为 600 MiB,内存限制为 800 MiB。
这些满足这个命名空间中 LimitRange 设定的限制范围。
```yaml
resources:
@@ -178,12 +187,12 @@ kubectl delete pod constraints-mem-demo --namespace=constraints-mem-example
<!--
## Attempt to create a Pod that exceeds the maximum memory constraint
Here's the configuration file for a Pod that has one Container. The Container specifies a
Here's a manifest for a Pod that has one container. The container specifies a
memory request of 800 MiB and a memory limit of 1.5 GiB.
-->
## 尝试创建一个超过最大内存限制的 Pod
这里给出了包含一个容器的 Pod 的配置文件。容器声明了800 MiB 的内存请求和1.5 GiB 的内存限制。
以下为包含一个容器的 Pod 的清单。这个容器声明了 800 MiB 的内存请求和 1.5 GiB 的内存限制。
{{< codenew file="admin/resource/memory-constraints-pod-2.yaml" >}}
@@ -197,10 +206,10 @@ kubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod-2
```
<!--
The output shows that the Pod does not get created, because the Container specifies a memory limit that is
too large:
The output shows that the Pod does not get created, because it defines a container that
requests more memory than is allowed:
-->
输出结果显示 Pod 没有创建成功,因为容器声明的内存限制太大了:
输出结果显示 Pod 没有创建成功,因为它定义了一个容器的内存请求超过了允许的值。
```
Error from server (Forbidden): error when creating "examples/admin/resource/memory-constraints-pod-2.yaml":
@@ -210,12 +219,12 @@ pods "constraints-mem-demo-2" is forbidden: maximum memory usage per Container i
<!--
## Attempt to create a Pod that does not meet the minimum memory request
Here's the configuration file for a Pod that has one Container. The Container specifies a
Here's a manifest for a Pod that has one container. That container specifies a
memory request of 100 MiB and a memory limit of 800 MiB.
-->
## 尝试创建一个不满足最小内存请求的 Pod
这里给出了包含一个容器的 Pod 的配置文件。容器声明了100 MiB 的内存请求和800 MiB 的内存限制。
以下为只有一个容器的 Pod 的清单。这个容器声明了 100 MiB 的内存请求和 800 MiB 的内存限制。
{{< codenew file="admin/resource/memory-constraints-pod-3.yaml" >}}
@@ -229,10 +238,10 @@ kubectl apply -f https://k8s.io/examples/admin/resource/memory-constraints-pod-3
```
<!--
The output shows that the Pod does not get created, because the Container specifies a memory
request that is too small:
The output shows that the Pod does not get created, because it defines a container
that requests less memory than the enforced minimum:
-->
输出结果显示 Pod 没有创建成功,因为容器声明的内存请求太小了
输出结果显示 Pod 没有创建成功,因为它定义了一个容器的内存请求小于强制要求的最小值
```
Error from server (Forbidden): error when creating "examples/admin/resource/memory-constraints-pod-3.yaml":
@@ -242,12 +251,12 @@ pods "constraints-mem-demo-3" is forbidden: minimum memory usage per Container i
<!--
## Create a Pod that does not specify any memory request or limit
Here's the configuration file for a Pod that has one Container. The Container does not
Here's a manifest for a Pod that has one container. The container does not
specify a memory request, and it does not specify a memory limit.
-->
## 创建一个没有声明内存请求和限制的 Pod
这里给出了包含一个容器的 Pod 的配置文件。容器没有声明内存请求,也没有声明内存限制。
以下为只有一个容器的 Pod 清单。该容器没有声明内存请求,也没有声明内存限制。
{{< codenew file="admin/resource/memory-constraints-pod-4.yaml" >}}
@@ -265,15 +274,15 @@ View detailed information about the Pod:
-->
查看 Pod 详情:
```
```shell
kubectl get pod constraints-mem-demo-4 --namespace=constraints-mem-example --output=yaml
```
<!--
The output shows that the Pod's Container has a memory request of 1 GiB and a memory limit of 1 GiB.
How did the Container get those values?
The output shows that the Pod's only container has a memory request of 1 GiB and a memory limit of 1 GiB.
How did that container get those values?
-->
输出结果显示 Pod 的内存请求为1 GiB,内存限制为1 GiB。容器怎样获得些数值呢?
输出结果显示 Pod 的唯一容器内存请求为 1 GiB,内存限制为 1 GiB。容器怎样获得些数值呢?
```
resources:
@@ -284,15 +293,33 @@ resources:
```
<!--
Because your Container did not specify its own memory request and limit, it was given the
Because your Pod did not define any memory request and limit for that container, the cluster
applied a
[default memory request and limit](/docs/tasks/administer-cluster/memory-default-namespace/)
from the LimitRange.
-->
因为你的容器没有声明自己的内存请求和限制,从 LimitRange 那里获得了
[默认的内存请求和限制](/zh/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/)。
因为你的 Pod 没有为容器声明任何内存请求和限制,集群会从 LimitRange
获取[默认的内存请求和限制](/zh/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/)。
应用于容器。
<!--
At this point, your Container might be running or it might not be running. Recall that a prerequisite
This means that the definition of that Pod shows those values. You can check it using
`kubectl describe`:
```shell
# Look for the "Requests:" section of the output
kubectl describe pod constraints-mem-demo-4 --namespace=constraints-mem-example
```
-->
这意味着 Pod 的定义会显示这些值。你可以通过 `kubectl describe` 查看:
```shell
# 查看输出结果中的 "Requests:" 的值
kubectl describe pod constraints-mem-demo-4 --namespace=constraints-mem-example
```
<!--
At this point, your Pod might be running or it might not be running. Recall that a prerequisite
for this task is that your Nodes have at least 1 GiB of memory. If each of your Nodes has only
1 GiB of memory, then there is not enough allocatable memory on any Node to accommodate a memory
request of 1 GiB. If you happen to be using Nodes with 2 GiB of memory, then you probably have
@@ -300,13 +327,13 @@ enough space to accommodate the 1 GiB request.
Delete your Pod:
-->
此时,你的容器可能运行起来也可能没有运行起来。
回想一下我们本次任务的先决条件是你的每个节点都至少有1 GiB 的内存。
如果你的每个节点都只有1 GiB 的内存,那将没有一个节点拥有足够的可分配内存来满足1 GiB 的内存请求。
此时,你的 Pod 可能已经运行起来也可能没有运行起来。
回想一下我们本次任务的先决条件是你的每个节点都至少有 1 GiB 的内存。
如果你的每个节点都只有 1 GiB 的内存,那将没有一个节点拥有足够的可分配内存来满足 1 GiB 的内存请求。
删除你的 Pod
```
```shell
kubectl delete pod constraints-mem-demo-4 --namespace=constraints-mem-example
```
@@ -331,18 +358,18 @@ LimitRange 为命名空间设定的最小和最大内存限制只有在 Pod 创
As a cluster administrator, you might want to impose restrictions on the amount of memory that Pods can use.
For example:
* Each Node in a cluster has 2 GB of memory. You do not want to accept any Pod that requests
more than 2 GB of memory, because no Node in the cluster can support the request.
* Each Node in a cluster has 2 GiB of memory. You do not want to accept any Pod that requests
more than 2 GiB of memory, because no Node in the cluster can support the request.
* A cluster is shared by your production and development departments.
You want to allow production workloads to consume up to 8 GB of memory, but
you want development workloads to be limited to 512 MB. You create separate namespaces
You want to allow production workloads to consume up to 8 GiB of memory, but
you want development workloads to be limited to 512 MiB. You create separate namespaces
for production and development, and you apply memory constraints to each namespace.
-->
作为集群管理员,你可能想规定 Pod 可以使用的内存总量限制。例如:
* 集群的每个节点有 2 GB 内存。你不想接受任何请求超过 2 GB 的 Pod,因为集群中没有节点可以满足。
* 集群由生产部门和开发部门共享。你希望允许产品部门的负载最多耗用 8 GB 内存,
* 集群的每个节点有 2 GiB 内存。你不想接受任何请求超过 2 GiB 的 Pod,因为集群中没有节点可以满足。
* 集群由生产部门和开发部门共享。你希望允许产品部门的负载最多耗用 8 GiB 内存,
但是开发部门的负载最多可使用 512 MiB。
这时,你可以为产品部门和开发部门分别创建名字空间,并为各个名字空间设置内存约束。