[zh] Resync tasks for 1.21 (4)

This commit is contained in:
Qiming Teng
2021-05-14 13:41:11 +08:00
parent 44d3c6e83d
commit 1638e3543f
8 changed files with 102 additions and 66 deletions
@@ -20,14 +20,14 @@ weight: 60
<!--
This task shows you how to delete a StatefulSet.
--->
-->
本任务展示如何删除 StatefulSet。
## {{% heading "prerequisites" %}}
<!--
* This task assumes you have an application running on your cluster represented by a StatefulSet.
--->
-->
* 本任务假设在你的集群上已经运行了由 StatefulSet 创建的应用。
<!-- steps -->
@@ -36,7 +36,7 @@ This task shows you how to delete a StatefulSet.
<!--
You can delete a StatefulSet in the same way you delete other resources in Kubernetes: use the `kubectl delete` command, and specify the StatefulSet either by file or by name.
--->
-->
你可以像删除 Kubernetes 中的其他资源一样删除 StatefulSet:使用 `kubectl delete` 命令,并按文件或者名字指定 StatefulSet。
```shell
@@ -66,10 +66,11 @@ kubectl delete service <服务名称>
```
<!--
Deleting a StatefulSet through kubectl will scale it down to 0, thereby deleting all pods that are a part of it.
If you want to delete just the StatefulSet and not the pods, use `--cascade=false`.
When deleting a StatefulSet through `kubectl`, the StatefulSet scales down to 0. All Pods that are part of this workload are also deleted. If you want to delete only the StatefulSet and not the Pods, use `--cascade=false`.
For example:
--->
通过 `kubectl` 删除 StatefulSet 会将其缩容为 0,因此删除属于它的所有 Pod
通过 `kubectl` 删除 StatefulSet 时,StatefulSet 会被缩容为 0
属于该 StatefulSet 的所有 Pod 也被删除。
如果你只想删除 StatefulSet 而不删除 Pod,使用 `--cascade=false`
```shell
@@ -114,7 +115,8 @@ To simply delete everything in a StatefulSet, including the associated pods, you
-->
### 完全删除 StatefulSet {#complete-deletion-of-a-statefulset}
简单地删除 StatefulSet 中的所有内容,包括关联的 pods,你可能需要运行一系列类似于以下内容的命令:
要删除 StatefulSet 中的所有内容,包括关联的 pods,你可以运行
一系列如下所示的命令:
```shell
grace=$(kubectl get pods <stateful-set-pod> --template '{{.spec.terminationGracePeriodSeconds}}')
@@ -144,7 +146,7 @@ If you find that some pods in your StatefulSet are stuck in the 'Terminating' or
<!--
Learn more about [force deleting StatefulSet Pods](/docs/tasks/run-application/force-delete-stateful-set-pod/).
--->
-->
进一步了解[强制删除 StatefulSet 的 Pods](/zh/docs/tasks/run-application/force-delete-stateful-set-pod/)。