diff --git a/content/zh/docs/concepts/configuration/windows-resource-management.md b/content/zh/docs/concepts/configuration/windows-resource-management.md index 1a7d765e597cb..a34682f5ae011 100644 --- a/content/zh/docs/concepts/configuration/windows-resource-management.md +++ b/content/zh/docs/concepts/configuration/windows-resource-management.md @@ -46,90 +46,89 @@ Linux cgroup API 可用于收集 CPU、I/O 和内存使用统计数据。 容器不能使用来自主机的标识,因为安全帐户管理器(Security Account Manager,SAM)是独立的。 -## 内存预留 {#resource-management-memory} +## 内存管理 {#resource-management-memory} Windows 不像 Linux 一样提供杀手(killer)机制,杀死内存不足的进程。 Windows 始终将所有用户态内存分配视为虚拟内存,并强制使用页面文件(pagefile)。 -Windows 节点不会为容器中运行的进程过量使用内存。 +Windows 节点不会为进程过量使用内存。 最终结果是 Windows 不会像 Linux 那样达到内存不足的情况,Windows 将进程页面放到磁盘, 不会因为内存不足(OOM)而终止进程。 如果内存配置过量且所有物理内存都已耗尽,则换页性能就会降低。 - -你可以使用 kubelet 的 `--kubelet-reserve` 和/或 `--system-reserve` -参数设定工作负载的内存使用边界;这些参数负责表示节点上(容器外)的内存用量,并会减少 -[节点可分配(NodeAllocatable)](/zh/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable)内存量。 -在你部署工作负载时,会对容器设置资源限制值。 -这个限制值也会从 `NodeAllocatable` 中减去,并防止调度器在节点已满时增加更多 Pod。 +## CPU 管理 {#resource-management-cpu} + +Windows 可以限制为不同进程分配的 CPU 时间长度,但无法保证最小的 CPU 时间长度。 + +在 Windows 上,kubelet 支持使用命令行标志来设置 kubelet 进程的[调度优先级](https://docs.microsoft.com/zh-cn/windows/win32/procthread/scheduling-priorities): +`--windows-priorityclass`。 +与 Windows 主机上运行的其他进程相比,此标志允许 kubelet 进程获取更多的 CPU 时间片。 +有关允许值及其含义的更多信息,请访问 [Windows 优先级类](https://docs.microsoft.com/zh-cn/windows/win32/procthread/scheduling-priorities#priority-class)。 +为了确保运行的 Pod 不会耗尽 kubelet 的 CPU 时钟周期, +要将此标志设置为 `ABOVE_NORMAL_PRIORITY_CLASS` 或更高。 -{{< note >}} -当你为 Windows 容器设置内存资源限制时,你应设置一个内存限制但不指定内存请求, -或将请求值设为等于限制值。 -{{< /note >}} +## 资源预留 {#resource-reservation} -在 Windows 上,避免过量配置的良好做法是为 kubelet 配置至少 2GiB 的系统预留内存, -以满足 Windows、Kubernetes 和容器运行时开销。 +为了满足操作系统、容器运行时和 kubelet 等 Kubernetes 主机进程使用的内存和 CPU, +你可以(且应该)用 `--kube-reserved` 和/或 `--system-reserved` kubelet 标志来预留内存和 CPU 资源。 +在 Windows 上,这些值仅用于计算节点的[可分配](/zh/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable)资源。 -## CPU 预留 {#resource-management-cpu} +{{< caution >}} +在你部署工作负载时,需对容器设置内存和 CPU 资源的限制。 +这也会从 `NodeAllocatable` 中减去,帮助集群范围的调度器决定哪些 Pod 放到哪些节点上。 -为了满足操作系统、容器运行时和 kubelet 等 Kubernetes 主机进程的 CPU 使用量, -你可以(且应该)从 CPU 总量中预留一定百分比。 -你应该根据节点上可用的 CPU 核数来确定这个 CPU 预留量。 -要决定预留的 CPU 百分比,需确定每个节点的最大 Pod 密度, -并监控节点上运行的系统服务的 CPU 使用量,然后选择一个满足工作负载需求的值。 +若调度 Pod 时未设置限制值,可能对 Windows 节点过量配置资源。 +在极端情况下,这会让节点变得不健康。 +{{< /caution >}} -你可以使用 kubelet 的 `--kubelet-reserve` 和/或 `--system-reserve` -参数设定工作负载的 CPU 使用边界,以统计节点上(容器外)的 CPU 使用量。 -这会减少 `NodeAllocatable`。 -然后集群范围的调度器在决定放置 Pod 时会考虑这个预留量。 +在 Windows 上,一种好的做法是预留至少 2GiB 的内存。 -在 Windows 上,kubelet 支持使用命令行标志来设置 kubelet 进程的优先级:`--windows-priorityclass`。 -与 Windows 主机上运行的其他进程相比,此标志允许 kubelet 进程获取更多的 CPU 时间片。 -有关允许值及其含义的更多信息,请访问 [Windows 优先级类](https://docs.microsoft.com/zh-cn/windows/win32/procthread/scheduling-priorities#priority-class)。 -为了确保运行的 Pod 不会耗尽 kubelet 的 CPU 时钟周期, -要将此标志设置为 `ABOVE_NORMAL_PRIORITY_CLASS` 或更高。 +要决定预留多少 CPU,需明确每个节点的最大 Pod 密度, +并监控节点上运行的系统服务的 CPU 使用率,然后选择一个满足工作负载需求的值。 diff --git a/content/zh/docs/concepts/windows/intro.md b/content/zh/docs/concepts/windows/intro.md index f03ca6b0b1645..fb44b155a3421 100644 --- a/content/zh/docs/concepts/windows/intro.md +++ b/content/zh/docs/concepts/windows/intro.md @@ -81,7 +81,8 @@ Some node features are only available if you use a specific including: * HugePages: not supported for Windows containers -* Privileged containers: not supported for Windows containers +* Privileged containers: not supported for Windows containers. + [HostProcess Containers](/docs/tasks/configure-pod-container/create-hostprocess-pod/) offer similar functionality. * TerminationGracePeriod: requires containerD --> ## 兼容性与局限性 {#limitations} @@ -89,9 +90,10 @@ including: 某些节点层面的功能特性仅在使用特定[容器运行时](#container-runtime)时才可用; 另外一些特性则在 Windows 节点上不可用,包括: -* 巨页(HugePages):Windows 容器当前不支持 -* 特权容器:Windows 容器当前不支持 -* TerminationGracePeriod:需要 containerD +* 巨页(HugePages):Windows 容器当前不支持。 +* 特权容器:Windows 容器当前不支持。 + [HostProcess 容器](/zh/docs/tasks/configure-pod-container/create-hostprocess-pod/)提供类似功能。 +* TerminationGracePeriod:需要 containerD。 @@ -283,10 +286,9 @@ Some kubelet command line options behave differently on Windows, as described be [NodeAllocatable](/zh/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable)。 * 未实现使用 `--enforce-node-allocable` 驱逐。 * 未实现使用 `--eviction-hard` 和 `--eviction-soft` 驱逐。 -* 在 Windows 节点上运行的 kubelet 没有内存限制。 - `--kubelet-reserve` 和 `--system-reserve` 没有对主机上运行的 kubelet 或进程设置限制。 - 这意味着 kubelet 或主机上的进程使用的内存可能会超过节点可分配内存和调度器设定的内存, - 从而造成内存资源不足。 +* 在 Windows 节点上运行时,kubelet 没有内存或 CPU 限制。 + `--kube-reserved` 和 `--system-reserved` 仅从 `NodeAllocatable` 中减去,并且不保证为工作负载提供的资源。 + 有关更多信息,请参考 [Windows 节点的资源管理](/zh/docs/concepts/configuration/windows-resource-management/#resource-reservation)。 * 未实现 `MemoryPressure` 条件。 * kubelet 不会执行 OOM 驱逐操作。 @@ -488,15 +490,17 @@ Pod 的所有 [`securityContext`](/docs/reference/kubernetes-api/workload-resour 字段都无法在 Windows 上生效。 -### 节点问题检测器 {#node-problem-detector} +## 节点问题检测器 {#node-problem-detector} -节点问题检测器(参考[节点健康监测](/zh/docs/tasks/debug/debug-cluster/monitor-node-health/))与 Windows 不兼容。 +节点问题检测器(参考[节点健康监测](/zh/docs/tasks/debug/debug-cluster/monitor-node-health/))初步支持 Windows。 +有关更多信息,请访问该项目的 [GitHub 页面](https://github.com/kubernetes/node-problem-detector#windows)。 -#### cri-containerd {#cri-containerd} +#### ContainerD {#containerd} {{< feature-state for_k8s_version="v1.20" state="stable" >}} @@ -666,7 +670,7 @@ If you have what looks like a bug, or you would like to make a feature request, please follow the [SIG Windows contributing guide](https://github.com/kubernetes/community/blob/master/sig-windows/CONTRIBUTING.md#reporting-issues-and-feature-requests) to create a new issue. You should first search the list of issues in case it was reported previously and comment with your experience on the issue and add additional -logs. SIG-Windows Slack is also a great avenue to get some initial support and +logs. SIG Windows channel on the Kubernetes Slack is also a great avenue to get some initial support and troubleshooting ideas prior to creating a ticket. --> ### 报告问题和功能请求 {#report-issue-and-feature-request} @@ -674,9 +678,10 @@ troubleshooting ideas prior to creating a ticket. 如果你发现疑似 bug,或者你想提出功能请求,请按照 [SIG Windows 贡献指南](https://github.com/kubernetes/community/blob/master/sig-windows/CONTRIBUTING.md#reporting-issues-and-feature-requests) 新建一个 Issue。 -您应该先搜索 issue 列表,以防之前报告过这个问题,凭你对该问题的经验添加评论, +你应该先搜索 issue 列表,以防之前报告过这个问题,凭你对该问题的经验添加评论, 并随附日志信息。 -SIG Windows Slack 也是一个很好的途径,让你在创建工单之前获得一些初始支持和故障排查的思路。 +Kubernetes Slack 上的 SIG Windows 频道也是一个很好的途径, +可以在创建工单之前获得一些初始支持和故障排查思路。 ## {{% heading "whatsnext" %}}