Skip to content

Commit 5f95911

Browse files
committed
[zh-cn]sync kubectl_delete kubectl_wait kubectl_create
Signed-off-by: xin.li <[email protected]>
1 parent 3afda07 commit 5f95911

File tree

3 files changed

+69
-39
lines changed

3 files changed

+69
-39
lines changed

content/zh-cn/docs/reference/kubectl/generated/kubectl_create/_index.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@ kubectl create -f FILENAME
4646
```
4747
-->
4848
```shell
49-
# 使用 pod.json 中的数据创建一个 Pod
50-
kubectl create -f ./pod.json
51-
52-
# 基于传入到标准输入的 JSON 创建一个 Pod
53-
cat pod.json | kubectl create -f -
54-
55-
# 以 JSON 编辑 registry.yaml 中的数据,然后使用已编辑的数据来创建资源
56-
kubectl create -f registry.yaml --edit -o json
49+
# 使用 pod.json 中的数据创建一个 Pod
50+
kubectl create -f ./pod.json
51+
52+
# 基于传入到标准输入的 JSON 创建一个 Pod
53+
cat pod.json | kubectl create -f -
54+
55+
# 以 JSON 编辑 registry.yaml 中的数据,然后使用已编辑的数据来创建资源
56+
kubectl create -f registry.yaml --edit -o json
5757
```
5858

5959
## {{% heading "options" %}}
6060

61-
<table style="width: 100%; table-layout: fixed;">
61+
<table style="width: 100%; table-layout: fixed;">
6262
<colgroup>
6363
<col span="1" style="width: 10px;" />
6464
<col span="1" />
@@ -245,12 +245,12 @@ Template string or path to template file to use when -o=go-template, -o=go-templ
245245
<tr>
246246
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
247247
<!--
248-
Must be one of: strict (or true), warn, ignore (or false).<br/>&quot;true&quot; or &quot;strict&quot; will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not.<br/>&quot;warn&quot; will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as &quot;ignore&quot; otherwise.<br/>&quot;false&quot; or &quot;ignore&quot; will not perform any schema validation, silently dropping any unknown or duplicate fields.
248+
Must be one of: strict (or true), warn, ignore (or false). &quot;true&quot; or &quot;strict&quot; will use a schema to validate the input and fail the request if invalid. It will perform server side validation if ServerSideFieldValidation is enabled on the api-server, but will fall back to less reliable client-side validation if not. &quot;warn&quot; will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as &quot;ignore&quot; otherwise. &quot;false&quot; or &quot;ignore&quot; will not perform any schema validation, silently dropping any unknown or duplicate fields.
249249
-->
250-
必须是以下选项之一:strict(或 true)、warn、ignore(或 false)。<br/>
250+
必须是以下选项之一:strict(或 true)、warn、ignore(或 false)。
251251
"true" 或 "strict" 将使用模式定义来验证输入,如果无效,则请求失败。
252252
如果在 API 服务器上启用了 ServerSideFieldValidation,则执行服务器端验证,
253-
但如果未启用,它将回退到可靠性较低的客户端验证。<br/>
253+
但如果未启用,它将回退到可靠性较低的客户端验证。
254254
如果在 API 服务器上启用了服务器端字段验证,"warn" 将警告未知或重复的字段而不阻止请求,
255255
否则操作与 "ignore" 的表现相同。<br/>
256256
"false" 或 "ignore" 将不会执行任何模式定义检查,而是静默删除所有未知或重复的字段。
@@ -274,7 +274,7 @@ Only relevant if --edit=true. Defaults to the line ending native to your platfor
274274

275275
## {{% heading "parentoptions" %}}
276276

277-
<table style="width: 100%; table-layout: fixed;">
277+
<table style="width: 100%; table-layout: fixed;">
278278
<colgroup>
279279
<col span="1" style="width: 10px;" />
280280
<col span="1" />

content/zh-cn/docs/reference/kubectl/generated/kubectl_delete/_index.md

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,48 +63,71 @@ kubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)
6363
<!--
6464
```
6565
# Delete a pod using the type and name specified in pod.json
66+
kubectl delete -f ./pod.json
67+
6668
# Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml
69+
kubectl delete -k dir
70+
6771
# Delete resources from all files that end with '.json'
72+
kubectl delete -f '*.json'
73+
6874
# Delete a pod based on the type and name in the JSON passed into stdin
75+
cat pod.json | kubectl delete -f -
76+
6977
# Delete pods and services with same names "baz" and "foo"
78+
kubectl delete pod,service baz foo
79+
7080
# Delete pods and services with label name=myLabel
81+
kubectl delete pods,services -l name=myLabel
82+
7183
# Delete a pod with minimal delay
84+
kubectl delete pod foo --now
85+
7286
# Force delete a pod on a dead node
87+
kubectl delete pod foo --force
88+
7389
# Delete all pods
90+
kubectl delete pods --all
91+
92+
# Delete all pods only if the user confirms the deletion
93+
kubectl delete pods --all --interactive
7494
```
7595
-->
7696
```shell
7797
# 使用 pod.json 中指定的类型和名称删除一个 Pod
7898
kubectl delete -f ./pod.json
79-
99+
80100
# 基于包含 kustomization.yaml 的目录(例如 dir/kustomization.yaml)中的内容删除资源
81101
kubectl delete -k dir
82-
102+
83103
# 删除所有以 '.json' 结尾的文件中的资源
84104
kubectl delete -f '*.json'
85-
105+
86106
# 基于传递到标准输入的 JSON 中的类型和名称删除一个 Pod
87107
cat pod.json | kubectl delete -f -
88-
108+
89109
# 删除名称为 "baz" 和 "foo" 的 Pod 和 Service
90110
kubectl delete pod,service baz foo
91-
111+
92112
# 删除打了标签 name=myLabel 的 Pod 和 Service
93113
kubectl delete pods,services -l name=myLabel
94-
114+
95115
# 以最小延迟删除一个 Pod
96116
kubectl delete pod foo --now
97-
117+
98118
# 强制删除一个死节点上的 Pod
99119
kubectl delete pod foo --force
100-
120+
101121
# 删除所有 Pod
102122
kubectl delete pods --all
123+
124+
# 仅在用户确认删除的情况下删除所有 Pod
125+
kubectl delete pods --all --interactive
103126
```
104127

105128
## {{% heading "options" %}}
106129

107-
<table style="width: 100%; table-layout: fixed;">
130+
<table style="width: 100%; table-layout: fixed;">
108131
<colgroup>
109132
<col span="1" style="width: 10px;" />
110133
<col span="1" />
@@ -353,7 +376,7 @@ If true, wait for resources to be gone before returning. This waits for finalize
353376

354377
## {{% heading "parentoptions" %}}
355378

356-
<table style="width: 100%; table-layout: fixed;">
379+
<table style="width: 100%; table-layout: fixed;">
357380
<colgroup>
358381
<col span="1" style="width: 10px;" />
359382
<col span="1" />

content/zh-cn/docs/reference/kubectl/generated/kubectl_wait/_index.md

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,20 @@ Experimental: Wait for a specific condition on one or many resources.
1919
2020
The command takes multiple resources and waits until the specified condition is seen in the Status field of every given resource.
2121
22-
Alternatively, the command can wait for the given set of resources to be deleted by providing the "delete" keyword as the value to the --for flag.
22+
Alternatively, the command can wait for the given set of resources to be created or deleted by providing the "create" or "delete" keyword as the value to the --for flag.
2323
2424
A successful message will be printed to stdout indicating when the specified condition has been met. You can use -o option to change to output destination.
2525
-->
2626
实验特性:等待一个或多个资源到达特定状态。
2727

2828
- 此命令接受多个资源作为输入,并等待直到在每个给定资源的状态字段中看到所指定的状况。
2929

30-
- 此外,这一命令可以通过提供 "delete" 关键字作为 --for 标志的值来等待给定的一组资源被删除
30+
- 或者,这一命令可以通过为 `--for` 标志提供 "create" 或 "delete" 关键字值,来等待给定的一组资源被创建或删除
3131

3232
- 当指定条件被满足时,命令将向 stdout 打印一条成功消息。你可以使用 -o 选项更改输出目标。
3333

34-
3534
```shell
36-
kubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for condition=available|--for=jsonpath='{}'[=value]]
35+
kubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=create|--for=delete|--for condition=available|--for=jsonpath='{}'[=value]]
3736
```
3837
3938
## {{% heading "examples" %}}
@@ -42,19 +41,23 @@ kubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l
4241
```
4342
# Wait for the pod "busybox1" to contain the status condition of type "Ready"
4443
kubectl wait --for=condition=Ready pod/busybox1
45-
44+
4645
# The default value of status condition is true; you can wait for other targets after an equal delimiter (compared after Unicode simple case folding, which is a more general form of case-insensitivity)
4746
kubectl wait --for=condition=Ready=false pod/busybox1
48-
47+
4948
# Wait for the pod "busybox1" to contain the status phase to be "Running"
5049
kubectl wait --for=jsonpath='{.status.phase}'=Running pod/busybox1
51-
50+
5251
# Wait for pod "busybox1" to be Ready
5352
kubectl wait --for='jsonpath={.status.conditions[?(@.type=="Ready")].status}=True' pod/busybox1
54-
53+
5554
# Wait for the service "loadbalancer" to have ingress
5655
kubectl wait --for=jsonpath='{.status.loadBalancer.ingress}' service/loadbalancer
57-
56+
57+
# Wait for the secret "busybox1" to be created, with a timeout of 30s
58+
kubectl create secret generic busybox1
59+
kubectl wait --for=create secret/busybox1 --timeout=30s
60+
5861
# Wait for the pod "busybox1" to be deleted, with a timeout of 60s, after having issued the "delete" command
5962
kubectl delete pod/busybox1
6063
kubectl wait --for=delete pod/busybox1 --timeout=60s
@@ -63,19 +66,23 @@ kubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l
6366
```shell
6467
# 等待 Pod "busybox1" 包含 "Ready" 类型的状况值
6568
kubectl wait --for=condition=Ready pod/busybox1
66-
69+
6770
# 状态状况的默认值为真;可以在等号分隔符后给出其他等待目标(用 Unicode 大小写折叠形式转换之后执行比较,这是更通用的大小写不敏感形式)
6871
kubectl wait --for=condition=Ready=false pod/busybox1
69-
72+
7073
# 等待 Pod "busybox1" 的状态阶段包含 "Running"
7174
kubectl wait --for=jsonpath='{.status.phase}'=Running pod/busybox1
72-
75+
7376
# 等待 Pod "busybox1" 状况变为 Ready
7477
kubectl wait --for='jsonpath={.status.conditions[?(@.type=="Ready")].status}=True' pod/busybox1
7578

7679
# 等待 Service "loadbalancer" 具备入站规则
7780
kubectl wait --for=jsonpath='{.status.loadBalancer.ingress}' service/loadbalancer
78-
81+
82+
# 等待名为 "busybox1" 的 Secret 被创建,超时时间为 30 秒
83+
kubectl create secret generic busybox1
84+
kubectl wait --for=create secret/busybox1 --timeout=30s
85+
7986
# 发出 "delete" 命令后,等待 Pod "busybox1" 被删除,超时时间为 60 秒
8087
kubectl delete pod/busybox1
8188
kubectl wait --for=delete pod/busybox1 --timeout=60s
@@ -160,9 +167,9 @@ identifying the resource.
160167
<td></td><td style="line-height: 130%; word-wrap: break-word;">
161168
<p>
162169
<!--
163-
The condition to wait on: [delete|condition=condition-name[=condition-value]|jsonpath='{JSONPath expression}'=[JSONPath value]]. The default condition-value is true. Condition values are compared after Unicode simple case folding, which is a more general form of case-insensitivity.
170+
The condition to wait on: [create|delete|condition=condition-name[=condition-value]|jsonpath='{JSONPath expression}'=[JSONPath value]]. The default condition-value is true. Condition values are compared after Unicode simple case folding, which is a more general form of case-insensitivity.
164171
-->
165-
等待的条件:[delete|condition=condition-name[=condition-value]|jsonpath='{JSONPath expression}'=[JSONPath value]]。
172+
等待的条件:[create|delete|condition=condition-name[=condition-value]|jsonpath='{JSONPath expression}'=[JSONPath value]]。
166173
默认的状况值为 true。在执行 Unicode 大小写折叠之后比较条件值,这是更通用的不区分大小写形式。
167174
</p></td>
168175
</tr>
@@ -263,7 +270,7 @@ Template string or path to template file to use when -o=go-template, -o=go-templ
263270
<td></td><td style="line-height: 130%; word-wrap: break-word;">
264271
<p>
265272
<!--
266-
The length of time to wait before giving up. Zero means check once and don't wait, negative means wait for a week.
273+
The length of time to wait before giving up. Zero means check once and don't wait, negative means wait for a week.
267274
-->
268275
放弃前等待的时间长度。0 表示检查一次,不等待,负数表示等待一周。
269276
</p></td>

0 commit comments

Comments
 (0)