mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
add the Chhinese translation of docs list & install (#1022)
* Chinese docs list * translate INSTALL.md * supplement * translate workflows.md * fix * update README & INSTALL * Fix bad links * squash all the commits of Chinese docs
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
English | [简体中文](zh/README.md)
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
|
|
||||||
* [Installation](INSTALL.md)
|
* [Installation](INSTALL.md)
|
||||||
|
|||||||
39
docs/zh/INSTALL.md
Normal file
39
docs/zh/INSTALL.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
[release 页面]: https://github.com/kubernetes-sigs/kustomize/releases
|
||||||
|
[Go]: https://golang.org
|
||||||
|
[golang.org]: https://golang.org
|
||||||
|
|
||||||
|
## 安装
|
||||||
|
|
||||||
|
在 macOS ,您可以使用软件包管理器 Homebrew 来安装 kustomize 。
|
||||||
|
|
||||||
|
brew install kustomize
|
||||||
|
|
||||||
|
在 windows ,您可以使用软件包管理器 Chocolatey 来安装 kustomize 。
|
||||||
|
|
||||||
|
choco install kustomize
|
||||||
|
|
||||||
|
有关软件包管理器 chocolatey 的使用以及对之前版本的支持,请参考以下链接:
|
||||||
|
- [Choco Package](https://chocolatey.org/packages/kustomize)
|
||||||
|
- [Package Source](https://github.com/kenmaglio/choco-kustomize)
|
||||||
|
|
||||||
|
对于其他系统,请在 [release 页面] 下载相应系统的二进制文件。
|
||||||
|
|
||||||
|
或者使用命令行获取最新的官方版本:
|
||||||
|
|
||||||
|
```
|
||||||
|
opsys=linux # or darwin, or windows
|
||||||
|
curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases/latest |\
|
||||||
|
grep browser_download |\
|
||||||
|
grep $opsys |\
|
||||||
|
cut -d '"' -f 4 |\
|
||||||
|
xargs curl -O -L
|
||||||
|
mv kustomize_*_${opsys}_amd64 kustomize
|
||||||
|
chmod u+x kustomize
|
||||||
|
```
|
||||||
|
|
||||||
|
使用 [Go] v1.10.1 或更高版本安装(如果可以访问 [golang.org]):
|
||||||
|
|
||||||
|
<!-- @installkustomize @test -->
|
||||||
|
```
|
||||||
|
go get sigs.k8s.io/kustomize
|
||||||
|
```
|
||||||
42
docs/zh/README.md
Normal file
42
docs/zh/README.md
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
[English](../README.md) | 简体中文
|
||||||
|
|
||||||
|
# 文档
|
||||||
|
|
||||||
|
* [安装说明](INSTALL.md)
|
||||||
|
|
||||||
|
* [示例](../../examples) - 各种使用流程和概念的详细演示。
|
||||||
|
|
||||||
|
* [术语表](../glossary.md) - 用于消除术语歧义。
|
||||||
|
|
||||||
|
* [kustomization.yaml](../kustomization.yaml) - 包含
|
||||||
|
[kustomization](../glossary.md#kustomization) 所有字段的示例文件。
|
||||||
|
|
||||||
|
* [插件](../plugins.md) - 使用自定义的资源生成器和资源转换器来拓展 kustomize 功能。
|
||||||
|
|
||||||
|
* [工作流](workflows.md) - 使用定制及使用现成配置使用的一些步骤。
|
||||||
|
|
||||||
|
* [FAQ](../FAQ.md)
|
||||||
|
|
||||||
|
|
||||||
|
## 发行说明
|
||||||
|
|
||||||
|
* [2.1](../v_2.1.0.md)
|
||||||
|
|
||||||
|
* [2.0](../v_2.0.0.md) -
|
||||||
|
可以在 [kubectl v1.14][kubectl] 中使用 kustomize [v2.0.3] 。
|
||||||
|
|
||||||
|
|
||||||
|
## 政策
|
||||||
|
|
||||||
|
* [版本控制](../versioningPolicy.md) - kustomize 代码及 kustomization 文件的版本控制策略。
|
||||||
|
|
||||||
|
* [规避功能](../eschewedFeatures.md) - 目前 Kustomize 不支持某些功能的原因。
|
||||||
|
|
||||||
|
* [贡献指南](../../CONTRIBUTING.md) - 请在提交 PR 之前阅读。
|
||||||
|
|
||||||
|
* [行为准则](../../code-of-conduct.md)
|
||||||
|
|
||||||
|
关于中文文档:部分文档可能稍微滞后于英文版本,同步工作持续进行中
|
||||||
|
|
||||||
|
[v2.0.3]: https://github.com/kubernetes-sigs/kustomize/releases/tag/v2.0.3
|
||||||
|
[kubectl]: https://kubernetes.io/blog/2019/03/25/kubernetes-1-14-release-announcement
|
||||||
127
docs/zh/workflows.md
Normal file
127
docs/zh/workflows.md
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
[OTS]: ../glossary.md#off-the-shelf-configuration
|
||||||
|
[apply]: ../glossary.md#apply
|
||||||
|
[applying]: ../glossary.md#apply
|
||||||
|
[base]: ../glossary.md#base
|
||||||
|
[fork]: https://guides.github.com/activities/forking/
|
||||||
|
[variants]: ../glossary.md#variant
|
||||||
|
[kustomization]: ../glossary.md#kustomization
|
||||||
|
[off-the-shelf]: ../glossary.md#off-the-shelf-configuration
|
||||||
|
[overlays]: ../glossary.md#overlay
|
||||||
|
[patch]: ../glossary.md#patch
|
||||||
|
[patches]: ../glossary.md#patch
|
||||||
|
[rebase]: https://git-scm.com/docs/git-rebase
|
||||||
|
[resources]: ../glossary.md#resource
|
||||||
|
[workflowBespoke]: ../workflowBespoke.jpg
|
||||||
|
[workflowOts]: ../workflowOts.jpg
|
||||||
|
[kubectl-v1.14.0]:https://kubernetes.io/blog/2019/03/25/kubernetes-1-14-release-announcement/
|
||||||
|
|
||||||
|
# 工作流
|
||||||
|
|
||||||
|
工作流是 kustomize 运行和维护配置的步骤。
|
||||||
|
|
||||||
|
## 配置定制(Bespoke configuration)
|
||||||
|
|
||||||
|
在这个工作流方式中,所有的配置文件( YAML 资源)都为用户所有,存储在用户的私有 repo 中。其他用户是无法使用的。
|
||||||
|
|
||||||
|
![bespoke config workflow image][workflowBespoke]
|
||||||
|
|
||||||
|
#### 1) 创建一个目录用于版本控制
|
||||||
|
|
||||||
|
我们希望将一个名为 _ldap_ 的 Kubernetes 集群应用的配置保存在自己的 repo 中。
|
||||||
|
这里使用 git 进行版本控制。
|
||||||
|
|
||||||
|
> ```
|
||||||
|
> git init ~/ldap
|
||||||
|
> ```
|
||||||
|
|
||||||
|
#### 2) 创建一个 [base]
|
||||||
|
|
||||||
|
> ```
|
||||||
|
> mkdir -p ~/ldap/base
|
||||||
|
> ```
|
||||||
|
|
||||||
|
在这个目录中创建并提交 [kustomization] 文件及一组资源配置。
|
||||||
|
|
||||||
|
#### 3) 创建 [overlays]
|
||||||
|
|
||||||
|
> ```
|
||||||
|
> mkdir -p ~/ldap/overlays/staging
|
||||||
|
> mkdir -p ~/ldap/overlays/production
|
||||||
|
> ```
|
||||||
|
|
||||||
|
每个目录都包含需要一个 [kustomization] 文件以及一或多个 [patches]。
|
||||||
|
|
||||||
|
在 _staging_ 目录可能会有一个用于在 configmap 中打开一个实验标记的补丁。
|
||||||
|
|
||||||
|
在 _production_ 目录可能会有一个在 deployment 中增加副本数的补丁。
|
||||||
|
|
||||||
|
#### 4) 生成 [variants]
|
||||||
|
|
||||||
|
运行 kustomize,将生成的配置用于 kubernetes 应用发布。
|
||||||
|
|
||||||
|
> ```
|
||||||
|
> kustomize build ~/ldap/overlays/staging | kubectl apply -f -
|
||||||
|
> kustomize build ~/ldap/overlays/production | kubectl apply -f -
|
||||||
|
> ```
|
||||||
|
|
||||||
|
也可以在 [kubectl-v1.14.0] 版,使用 ```kubectl``` 命令发布你的 [variants] 。
|
||||||
|
> ```
|
||||||
|
> kubectl apply -k ~/ldap/overlays/staging
|
||||||
|
> kubectl apply -k ~/ldap/overlays/production
|
||||||
|
> ```
|
||||||
|
|
||||||
|
## 使用现成的配置(Off-the-shelf configuration)
|
||||||
|
|
||||||
|
在这个工作流方式中,可从别人的 repo 中 fork kustomize 配置,并根据自己的需求来配置。
|
||||||
|
|
||||||
|
|
||||||
|
![off-the-shelf config workflow image][workflowOts]
|
||||||
|
|
||||||
|
#### 1) 寻找并且 [fork] 一个 [OTS] 配置
|
||||||
|
|
||||||
|
#### 2) 将其克隆为你自己的 [base]
|
||||||
|
|
||||||
|
这个 [base] 目录维护在上游为 [OTS] 配置的 repo ,在这个例子使用 `ladp` 的 repo 。
|
||||||
|
|
||||||
|
> ```
|
||||||
|
> mkdir ~/ldap
|
||||||
|
> git clone https://github.com/$USER/ldap ~/ldap/base
|
||||||
|
> cd ~/ldap/base
|
||||||
|
> git remote add upstream git@github.com:$USER/ldap
|
||||||
|
> ```
|
||||||
|
|
||||||
|
#### 3) 创建 [overlays]
|
||||||
|
|
||||||
|
如配置定制方法一样,创建并完善 _overlays_ 目录中的内容。
|
||||||
|
|
||||||
|
所有的 [overlays] 都依赖于 [base] 。
|
||||||
|
|
||||||
|
> ```
|
||||||
|
> mkdir -p ~/ldap/overlays/staging
|
||||||
|
> mkdir -p ~/ldap/overlays/production
|
||||||
|
> ```
|
||||||
|
|
||||||
|
用户可以将 `overlays` 维护在不同的 repo 中。
|
||||||
|
|
||||||
|
#### 4) 生成 [variants]
|
||||||
|
|
||||||
|
> ```
|
||||||
|
> kustomize build ~/ldap/overlays/staging | kubectl apply -f -
|
||||||
|
> kustomize build ~/ldap/overlays/production | kubectl apply -f -
|
||||||
|
> ```
|
||||||
|
|
||||||
|
也可以在 [kubectl-v1.14.0] 版,使用 ```kubectl``` 命令发布你的 [variants] 。
|
||||||
|
> ```
|
||||||
|
> kubectl apply -k ~/ldap/overlays/staging
|
||||||
|
> kubectl apply -k ~/ldap/overlays/production
|
||||||
|
> ```
|
||||||
|
|
||||||
|
#### 5) (可选)从上游更新
|
||||||
|
|
||||||
|
用户可以定期从上游 repo 中 [rebase] 他们的 [base] 以保证及时更新。
|
||||||
|
|
||||||
|
> ```
|
||||||
|
> cd ~/ldap/base
|
||||||
|
> git fetch upstream
|
||||||
|
> git rebase upstream/master
|
||||||
|
> ```
|
||||||
Reference in New Issue
Block a user