abcee2dccd
* Update localization guidelines for language labels
Continuing work
Continuing work
Continuing work
More work in progress
Add local OWNERS folders
Add an OWNERS file to Chinese
Remove shortcode for repos
Add Japanese
Alphabetize languages, change weights accordingly
More updates
Add Korean in Korean
Add English to languageName
Feedback from gochist
Move Chinese content from cn/ to zh/
Move OWNERS from cn/ to zh/
Resolve merge conflicts by updating from master
Add files back in to prep for resolution
After rebase on upstream/master, remove files
Review and update localization guidelines
Feedback from gochist, tnir, cstoku
Add a trailing newline to content/ja/OWNERS
Add a trailing newline to content/zh/OWNERS
Drop requirement for GH repo project
Clarify language about forks/branches
Edits and typos
Remove a shortcode specific to a multi-repo language setup
Update aliases and owners
Add explicit OWNERS for content/en
Migrate content from Chinese repo, update regex in config.toml
Remove untranslated strings
Add trailing newline to content/en/OWNERS
Add trailing newlines to OWNERS files
add Jaguar project description (#10433)
* add Jaguar project description
[Jaguar](https://gitlab.com/sdnlab/jaguar) is an open source solution for Kubernetes's network based on OpenDaylight.
Jaguar provides overlay network using vxlan and Jaguar CNIPlugin provides one IP address per pod.
* Minor newline tweak
blog post for azure vmss (#10538)
Add microk8s to pick-right-solution.md (#10542)
* Add microk8s to pick-right-solution.md
Microk8s is a single-command installation of upstream Kubernetes on any Linux and should be included in the list of local-machine solutions.
* capitalized Istio
Add microk8s to foundational.md (#10543)
* Add microk8s to foundational.md
Adding microk8s as credible and stable alternative to get started with Kubernetes on a local machine. This is especially attractive for those not wanting to incur the overhead of running a VM for a local cluster.
* Update foundational.md
Thank you for your suggestions! LMK if this works now?
* Rewrote first paragraph
And included a bullet list of features of microk8s
* Copyedit
fix typo (#10545)
Fix the kubectl subcommands links. (#10550)
Signed-off-by: William Zhang <warmchang@outlook.com>
Fix command issue (#10515)
Signed-off-by: mooncake <xcoder@tenxcloud.com>
remove imported community files per issue 10184 (#10501)
networking.md: Markdown fix (#10498)
Fix front matter, federation command-line tools (#10500)
Clean up glossary entry (#10399)
update slack link (#10536)
typo in StatefulSet docs (#10558)
fix discription about horizontal pod autoscale (#10557)
Remove redundant symbols (#10556)
Fix issue #10520 (#10554)
Signed-off-by: William Zhang <warmchang@outlook.com>
Update api-concepts.md (#10534)
Revert "Fix command issue (#10515)"
This reverts commit c02a7fb9f9.
Update memory-constraint-namespace.md (#10530)
update memory request to 100MiB corresponding the yaml content
Blog: Introducing Volume Snapshot Alpha for Kubernetes (#10562)
* blog post for azure vmss
* snapshot blog post
Resolve merge conflicts in OWNERS*
Minor typo fix (#10567)
Not sure what's supposed to be here, proposing removing it.
* Feedback from gochist
Tweaks to feedback
* Feedback from ClaudiaJKang
124 lines
3.1 KiB
Markdown
124 lines
3.1 KiB
Markdown
---
|
||
approvers:
|
||
- jessfraz
|
||
title: 使用 PodPreset 将信息注入 Pods
|
||
---
|
||
|
||
在 pod 创建时,用户可以使用 `podpreset` 对象将 secrets、卷挂载和环境变量等信息注入其中。
|
||
本文展示了一些 `PodPreset` 资源使用的示例。
|
||
用户可以从[理解 Pod Presets](/docs/concepts/workloads/pods/podpreset/) 中了解 PodPresets 的整体情况。
|
||
|
||
{{< toc >}}
|
||
|
||
## 创建 Pod Preset
|
||
|
||
### 简单的 Pod Spec 示例
|
||
|
||
这里是一个简单的示例,展示了如何通过 Pod Preset 修改 Pod spec 。
|
||
|
||
**用户提交的 pod spec:**
|
||
|
||
{{< code file="podpreset-pod.yaml" >}}
|
||
|
||
**Pod Preset 示例:**
|
||
|
||
{{< code file="podpreset-preset.yaml" >}}
|
||
|
||
**通过准入控制器后的 Pod spec:**
|
||
|
||
{{< code file="podpreset-merged.yaml" >}}
|
||
|
||
### 带有 `ConfigMap` 的 Pod Spec 示例
|
||
|
||
这里的示例展示了如何通过 Pod Preset 修改 Pod spec,Pod Preset 中定义了 `ConfigMap` 作为环境变量取值来源。
|
||
|
||
**用户提交的 pod spec:**
|
||
|
||
{{< code file="podpreset-pod.yaml" >}}
|
||
|
||
**用户提交的 `ConfigMap`:**
|
||
|
||
{{< code file="podpreset-configmap.yaml" >}}
|
||
|
||
**Pod Preset 示例:**
|
||
|
||
{{< code file="podpreset-allow-db.yaml" >}}
|
||
|
||
**通过准入控制器后的 Pod spec:**
|
||
|
||
{{< code file="podpreset-allow-db-merged.yaml" >}}
|
||
|
||
### 带有 Pod Spec 的 ReplicaSet 示例
|
||
|
||
以下示例展示了(通过 ReplicaSet 创建 pod 后)只有 pod spec 会被 Pod Preset 所修改。
|
||
|
||
**用户提交的 ReplicaSet:**
|
||
|
||
{{< code file="podpreset-replicaset.yaml" >}}
|
||
|
||
**Pod Preset 示例:**
|
||
|
||
{{< code file="podpreset-preset.yaml" >}}
|
||
|
||
**通过准入控制器后的 Pod spec:**
|
||
|
||
注意 ReplicaSet spec 没有改变,用户必须检查单独的 pod 来验证 PodPreset 已被应用。
|
||
|
||
{{< code file="podpreset-replicaset-merged.yaml" >}}
|
||
|
||
### 多 PodPreset 示例
|
||
|
||
这里的示例展示了如何通过多个 Pod 注入策略修改 Pod spec。
|
||
|
||
**用户提交的 pod spec:**
|
||
|
||
{{< code file="podpreset-pod.yaml" >}}
|
||
|
||
**Pod Preset 示例:**
|
||
|
||
{{< code file="podpreset-preset.yaml" >}}
|
||
|
||
**另一个 Pod Preset 示例:**
|
||
|
||
{{< code file="podpreset-proxy.yaml" >}}
|
||
|
||
**通过准入控制器后的 Pod spec:**
|
||
|
||
{{< code file="podpreset-multi-merged.yaml" >}}
|
||
|
||
### 冲突示例
|
||
|
||
这里的示例展示了 Pod Preset 与原 Pod 存在冲突时,Pod spec 不会被修改。
|
||
|
||
**用户提交的 pod spec:**
|
||
|
||
{{< code file="podpreset-conflict-pod.yaml" >}}
|
||
|
||
**Pod Preset 示例:**
|
||
|
||
{{< code file="podpreset-conflict-preset.yaml" >}}
|
||
|
||
**因存在冲突,通过准入控制器后的 Pod spec 不会改变:**
|
||
|
||
{{< code file="podpreset-conflict-pod.yaml" >}}
|
||
|
||
**如果运行 `kubectl describe...` 用户会看到以下事件:**
|
||
|
||
```
|
||
$ kubectl describe ...
|
||
....
|
||
Events:
|
||
FirstSeen LastSeen Count From SubobjectPath Reason Message
|
||
Tue, 07 Feb 2017 16:56:12 -0700 Tue, 07 Feb 2017 16:56:12 -0700 1 {podpreset.admission.kubernetes.io/podpreset-allow-database } conflict Conflict on pod preset. Duplicate mountPath /cache.
|
||
```
|
||
|
||
## 删除 Pod Preset
|
||
|
||
一旦用户不再需要 pod preset,可以使用 `kubectl` 进行删除:
|
||
|
||
```shell
|
||
$ kubectl delete podpreset allow-database
|
||
podpreset "allow-database" deleted
|
||
```
|
||
|