Merge pull request #25429 from jiazxjason/patch-22
Update zh trans safely-drain-node.mdpull/25459/head
commit
49f7b70944
|
@ -1,28 +1,30 @@
|
||||||
---
|
---
|
||||||
title: 确保 PodDisruptionBudget 的前提下安全地清空一个节点
|
title: 安全地清空一个节点
|
||||||
content_type: task
|
content_type: task
|
||||||
|
min-kubernetes-server-version: 1.5
|
||||||
---
|
---
|
||||||
<!--
|
<!--
|
||||||
|
---
|
||||||
reviewers:
|
reviewers:
|
||||||
- davidopp
|
- davidopp
|
||||||
- mml
|
- mml
|
||||||
- foxish
|
- foxish
|
||||||
- kow3ns
|
- kow3ns
|
||||||
title: Safely Drain a Node while Respecting the PodDisruptionBudget
|
title: Safely Drain a Node
|
||||||
content_type: task
|
content_type: task
|
||||||
|
min-kubernetes-server-version: 1.5
|
||||||
|
---
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- overview -->
|
<!-- overview -->
|
||||||
<!--
|
<!--
|
||||||
This page shows how to safely drain a node, respecting the PodDisruptionBudget you have defined.
|
This page shows how to safely drain a node, respecting the PodDisruptionBudget you have defined.
|
||||||
-->
|
-->
|
||||||
本页展示了如何在确保 PodDisruptionBudget 的前提下,安全地清空一个
|
本页展示了如何在确保 PodDisruptionBudget 的前提下,安全地清空一个{{< glossary_tooltip text="节点" term_id="node" >}}。
|
||||||
{{< glossary_tooltip text="节点" term_id="node" >}}。
|
|
||||||
|
|
||||||
## {{% heading "prerequisites" %}}
|
## {{% heading "prerequisites" %}}
|
||||||
|
|
||||||
{{% version-check %}}
|
{{% version-check %}}
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
This task assumes that you have met the following prerequisites:
|
This task assumes that you have met the following prerequisites:
|
||||||
|
|
||||||
|
@ -30,20 +32,36 @@ This task assumes that you have met the following prerequisites:
|
||||||
* Either:
|
* Either:
|
||||||
1. You do not require your applications to be highly available during the
|
1. You do not require your applications to be highly available during the
|
||||||
node drain, or
|
node drain, or
|
||||||
1. You have read about the [PodDisruptionBudget concept](/docs/concepts/workloads/pods/disruptions/)
|
2. You have read about the [PodDisruptionBudget concept](/docs/concepts/workloads/pods/disruptions/)
|
||||||
and [Configured PodDisruptionBudgets](/docs/tasks/run-application/configure-pdb/) for
|
and [Configured PodDisruptionBudgets](/docs/tasks/run-application/configure-pdb/) for
|
||||||
applications that need them.
|
applications that need them.
|
||||||
-->
|
-->
|
||||||
此任务假设您已经满足以下先决条件:
|
此任务假定你已经满足了以下先决条件:
|
||||||
|
|
||||||
* 使用的 Kubernetes 版本 >= 1.5。
|
* 使用的 Kubernetes 版本 >= 1.5。
|
||||||
* 以下两项,具备其一:
|
* 以下两项,具备其一:
|
||||||
1. 在节点清空期间,不要求应用程序具有高可用性
|
1. 在节点清空期间,不要求应用程序具有高可用性
|
||||||
1. 你已经了解了 [PodDisruptionBudget 的概念](/zh/docs/concepts/workloads/pods/disruptions/),
|
2. 你已经了解了 [PodDisruptionBudget 的概念](/zh/docs/concepts/workloads/pods/disruptions/),
|
||||||
并为需要它的应用程序[配置了 PodDisruptionBudget](/zh/docs/tasks/run-application/configure-pdb/)。
|
并为需要它的应用程序[配置了 PodDisruptionBudget](/zh/docs/tasks/run-application/configure-pdb/)。
|
||||||
|
|
||||||
<!-- steps -->
|
<!-- steps -->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
## (Optional) Configure a disruption budget {#configure-poddisruptionbudget}
|
||||||
|
|
||||||
|
To endure that your workloads remain available during maintenance, you can
|
||||||
|
configure a [PodDisruptionBudget](/docs/concepts/workloads/pods/disruptions/).
|
||||||
|
|
||||||
|
If availability is important for any applications that run or could run on the node(s)
|
||||||
|
that you are draining, [configure a PodDisruptionBudgets](/docs/tasks/run-application/configure-pdb/)
|
||||||
|
first and the continue following this guide.
|
||||||
|
-->
|
||||||
|
## (可选) 配置干扰预算 {#configure-poddisruptionbudget}
|
||||||
|
|
||||||
|
为了确保你的负载在维护期间仍然可用,你可以配置一个 [PodDisruptionBudget](/zh/docs/concepts/workloads/pods/disruptions/)。
|
||||||
|
如果可用性对于正在清空的该节点上运行或可能在该节点上运行的任何应用程序很重要,
|
||||||
|
首先 [配置一个 PodDisruptionBudgets](/zh/docs/tasks/run-application/configure-pdb/) 并继续遵循本指南。
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
## Use `kubectl drain` to remove a node from service
|
## Use `kubectl drain` to remove a node from service
|
||||||
|
|
||||||
|
@ -176,8 +194,7 @@ itself. To attempt an eviction (perhaps more REST-precisely, to attempt to
|
||||||
[Kubernetes 语言客户端](/zh/docs/tasks/administer-cluster/access-cluster-api/#programmatic-access-to-the-api)。
|
[Kubernetes 语言客户端](/zh/docs/tasks/administer-cluster/access-cluster-api/#programmatic-access-to-the-api)。
|
||||||
|
|
||||||
Pod 的 Eviction 子资源可以看作是一种策略控制的 DELETE 操作,作用于 Pod 本身。
|
Pod 的 Eviction 子资源可以看作是一种策略控制的 DELETE 操作,作用于 Pod 本身。
|
||||||
要尝试驱逐(更准确地说,尝试 *创建* 一个 Eviction),需要用 POST
|
要尝试驱逐(更准确地说,尝试 *创建* 一个 Eviction),需要用 POST 发出所尝试的操作。这里有一个例子:
|
||||||
发出所尝试的操作。这里有一个例子:
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
@ -213,7 +230,7 @@ The API can respond in one of three ways:
|
||||||
- If there is some kind of misconfiguration, like multiple budgets pointing at
|
- If there is some kind of misconfiguration, like multiple budgets pointing at
|
||||||
the same pod, you will get `500 Internal Server Error`.
|
the same pod, you will get `500 Internal Server Error`.
|
||||||
-->
|
-->
|
||||||
API可以通过以下三种方式之一进行响应:
|
API 可以通过以下三种方式之一进行响应:
|
||||||
|
|
||||||
- 如果驱逐被授权,那么 Pod 将被删掉,并且你会收到 `200 OK`,
|
- 如果驱逐被授权,那么 Pod 将被删掉,并且你会收到 `200 OK`,
|
||||||
就像你向 Pod 的 URL 发送了 `DELETE` 请求一样。
|
就像你向 Pod 的 URL 发送了 `DELETE` 请求一样。
|
||||||
|
@ -229,7 +246,7 @@ For a given eviction request, there are two cases:
|
||||||
- There is no budget that matches this pod. In this case, the server always
|
- There is no budget that matches this pod. In this case, the server always
|
||||||
returns `200 OK`.
|
returns `200 OK`.
|
||||||
- There is at least one budget. In this case, any of the three above responses may
|
- There is at least one budget. In this case, any of the three above responses may
|
||||||
apply.
|
apply.
|
||||||
-->
|
-->
|
||||||
对于一个给定的驱逐请求,有两种情况:
|
对于一个给定的驱逐请求,有两种情况:
|
||||||
|
|
||||||
|
@ -272,9 +289,12 @@ Kubernetes 并没有具体说明在这种情况下应该采取什么行为,
|
||||||
|
|
||||||
## {{% heading "whatsnext" %}}
|
## {{% heading "whatsnext" %}}
|
||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
* Follow steps to protect your application by [configuring a Pod Disruption Budget](/docs/tasks/run-application/configure-pdb/).
|
* Follow steps to protect your application by [configuring a Pod Disruption Budget](/docs/tasks/run-application/configure-pdb/).
|
||||||
-->
|
* Learn more about [maintenance on a node](/docs/tasks/administer-cluster/cluster-management/#maintenance-on-a-node).
|
||||||
|
-->
|
||||||
* 执行[配置 PDB](/zh/docs/tasks/run-application/configure-pdb/)中的各个步骤,
|
* 执行[配置 PDB](/zh/docs/tasks/run-application/configure-pdb/)中的各个步骤,
|
||||||
保护你的应用
|
保护你的应用
|
||||||
|
* 进一步了解[节点维护](/zh/docs/tasks/administer-cluster/cluster-management/#maintenance-on-a-node)。
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue