Clean zh/docs directory for dangling YAML files (#17341)
There are many YAML manifests sneaking into the `zh/docs/` directory. These files should go to the `zh/examples` directory instead. Having these "garbage" files (not referenced anywhere) is creating confusion for the release meister when merging branches. For example, some YAML files found in the 'master' branch are no longer there in the release-1.16 branch. It is tedious, if possible at all, to solve all this kind of conflicts during a rebase. The PR cleanses the zh/docs directory for all dangling YAML files.
This commit is contained in:
@@ -16,37 +16,76 @@ title: 使用 PodPreset 将信息注入 Pods
|
||||
|
||||
这里是一个简单的示例,展示了如何通过 Pod Preset 修改 Pod spec 。
|
||||
|
||||
**用户提交的 pod spec:**
|
||||
{{< codenew file="podpreset/preset.yaml" >}}
|
||||
|
||||
{{< code file="podpreset-pod.yaml" >}}
|
||||
创建 PodPreset:
|
||||
|
||||
**Pod Preset 示例:**
|
||||
```shell
|
||||
kubectl apply -f https://k8s.io/examples/podpreset/preset.yaml
|
||||
```
|
||||
|
||||
{{< code file="podpreset-preset.yaml" >}}
|
||||
检查所创建的 PodPreset:
|
||||
|
||||
**通过准入控制器后的 Pod spec:**
|
||||
```shell
|
||||
kubectl get podpreset
|
||||
```
|
||||
```
|
||||
NAME AGE
|
||||
allow-database 1m
|
||||
```
|
||||
|
||||
{{< code file="podpreset-merged.yaml" >}}
|
||||
|
||||
### 带有 `ConfigMap` 的 Pod Spec 示例
|
||||
|
||||
这里的示例展示了如何通过 Pod Preset 修改 Pod spec,Pod Preset 中定义了 `ConfigMap` 作为环境变量取值来源。
|
||||
新的 PodPreset 会对所有具有标签 `role: frontend` 的 Pods 采取行动。
|
||||
|
||||
**用户提交的 pod spec:**
|
||||
|
||||
{{< code file="podpreset-pod.yaml" >}}
|
||||
{{< codenew file="podpreset/pod.yaml" >}}
|
||||
|
||||
创建 Pod:
|
||||
|
||||
```shell
|
||||
kubectl create -f https://k8s.io/examples/podpreset/pod.yaml
|
||||
```
|
||||
|
||||
列举运行中的 Pods:
|
||||
|
||||
```shell
|
||||
kubectl get pods
|
||||
```
|
||||
```
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
website 1/1 Running 0 4m
|
||||
```
|
||||
|
||||
**通过准入控制器后的 Pod 规约:**
|
||||
|
||||
{{< codenew file="podpreset/merged.yaml" >}}
|
||||
|
||||
要查看如上输出,运行下面的命令:
|
||||
|
||||
```shell
|
||||
kubectl get pod website -o yaml
|
||||
```
|
||||
|
||||
### 带有 ConfigMap 的 Pod Spec 示例
|
||||
|
||||
这里的示例展示了如何通过 PodPreset 修改 Pod 规约,PodPreset 中定义了 `ConfigMap`
|
||||
作为环境变量取值来源。
|
||||
|
||||
**用户提交的 pod spec:**
|
||||
|
||||
{{< codenew file="podpreset/pod.yaml" >}}
|
||||
|
||||
**用户提交的 `ConfigMap`:**
|
||||
|
||||
{{< code file="podpreset-configmap.yaml" >}}
|
||||
{{< codenew file="podpreset/configmap.yaml" >}}
|
||||
|
||||
**Pod Preset 示例:**
|
||||
**PodPreset 示例:**
|
||||
|
||||
{{< code file="podpreset-allow-db.yaml" >}}
|
||||
{{< codenew file="podpreset/allow-db.yaml" >}}
|
||||
|
||||
**通过准入控制器后的 Pod spec:**
|
||||
|
||||
{{< code file="podpreset-allow-db-merged.yaml" >}}
|
||||
{{< codenew file="podpreset/allow-db-merged.yaml" >}}
|
||||
|
||||
### 带有 Pod Spec 的 ReplicaSet 示例
|
||||
|
||||
@@ -54,53 +93,53 @@ title: 使用 PodPreset 将信息注入 Pods
|
||||
|
||||
**用户提交的 ReplicaSet:**
|
||||
|
||||
{{< code file="podpreset-replicaset.yaml" >}}
|
||||
{{< codenew file="podpreset/replicaset.yaml" >}}
|
||||
|
||||
**Pod Preset 示例:**
|
||||
**PodPreset 示例:**
|
||||
|
||||
{{< code file="podpreset-preset.yaml" >}}
|
||||
{{< codenew file="podpreset/preset.yaml" >}}
|
||||
|
||||
**通过准入控制器后的 Pod spec:**
|
||||
|
||||
注意 ReplicaSet spec 没有改变,用户必须检查单独的 pod 来验证 PodPreset 已被应用。
|
||||
|
||||
{{< code file="podpreset-replicaset-merged.yaml" >}}
|
||||
{{< codenew file="podpreset/replicaset-merged.yaml" >}}
|
||||
|
||||
### 多 PodPreset 示例
|
||||
|
||||
这里的示例展示了如何通过多个 Pod 注入策略修改 Pod spec。
|
||||
|
||||
**用户提交的 pod spec:**
|
||||
**用户提交的 Pod 规约:**
|
||||
|
||||
{{< code file="podpreset-pod.yaml" >}}
|
||||
{{< codenew file="podpreset/pod.yaml" >}}
|
||||
|
||||
**Pod Preset 示例:**
|
||||
**PodPreset 示例:**
|
||||
|
||||
{{< code file="podpreset-preset.yaml" >}}
|
||||
{{< codenew file="podpreset/preset.yaml" >}}
|
||||
|
||||
**另一个 Pod Preset 示例:**
|
||||
|
||||
{{< code file="podpreset-proxy.yaml" >}}
|
||||
{{< codenew file="podpreset/proxy.yaml" >}}
|
||||
|
||||
**通过准入控制器后的 Pod spec:**
|
||||
**通过准入控制器后的 Pod 规约:**
|
||||
|
||||
{{< code file="podpreset-multi-merged.yaml" >}}
|
||||
{{< codenew file="podpreset/multi-merged.yaml" >}}
|
||||
|
||||
### 冲突示例
|
||||
|
||||
这里的示例展示了 Pod Preset 与原 Pod 存在冲突时,Pod spec 不会被修改。
|
||||
这里的示例展示了 PodPreset 与原 Pod 存在冲突时,Pod spec 不会被修改。
|
||||
|
||||
**用户提交的 pod spec:**
|
||||
**用户提交的 Pod 规约:**
|
||||
|
||||
{{< code file="podpreset-conflict-pod.yaml" >}}
|
||||
{{< codenew file="podpreset/conflict-pod.yaml" >}}
|
||||
|
||||
**Pod Preset 示例:**
|
||||
**PodPreset 示例:**
|
||||
|
||||
{{< code file="podpreset-conflict-preset.yaml" >}}
|
||||
{{< codenew file="podpreset/conflict-preset.yaml" >}}
|
||||
|
||||
**因存在冲突,通过准入控制器后的 Pod spec 不会改变:**
|
||||
|
||||
{{< code file="podpreset-conflict-pod.yaml" >}}
|
||||
{{< codenew file="podpreset/conflict-pod.yaml" >}}
|
||||
|
||||
**如果运行 `kubectl describe...` 用户会看到以下事件:**
|
||||
|
||||
@@ -117,7 +156,9 @@ Events:
|
||||
一旦用户不再需要 pod preset,可以使用 `kubectl` 进行删除:
|
||||
|
||||
```shell
|
||||
$ kubectl delete podpreset allow-database
|
||||
kubectl delete podpreset allow-database
|
||||
```
|
||||
```
|
||||
podpreset "allow-database" deleted
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user