Update localization guidelines (#10485)

* 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
This commit is contained in:
Zach Corleissen
2018-10-12 14:25:01 -07:00
committed by k8s-ci-robot
parent 753f57f0e6
commit abcee2dccd
316 changed files with 9227 additions and 169 deletions
@@ -0,0 +1,137 @@
---
title: 使用命令式的方式管理 Kubernetes 对象
content_template: templates/concept
---
{{% capture overview %}}
直接使用内置的 `kubectl` 命令行工具,以命令式方式可以快速创建,更新和删除 Kubernetes 对象。本文档介绍了这些命令是如何组织的,以及如何使用它们来管理活动对象。
{{% /capture %}}
{{% capture body %}}
## 权衡
`kubectl` 工具支持三种方式进行对象的管理:
* 命令式的方式
* 命令式的对象配置
* 声明式的对象配置
参见[Kubernetes对象管理](/docs/concepts/tools/kubectl/object-management-overview/)
讨论各种对象管理方式的优缺点.
## 如何创建对象
`kubectl` 工具支持用于创建一些最常用的对象类型的动词驱动命令,这些命令的命名让不熟悉Kubernetes 对象的用户也可以见名知义。
- `run`: 创建一个新的 Deployment 对象以在一个或多个 Pod 中运行 Containers。
- `expose`: 创建一个新的 Service 对象用于负载均衡 Pods 上的的网络流量。
- `autoscale`: 创建一个新的 Autoscaler 对象,来实现 Deployment 等控制器的自动水平拓展。
`kubectl` 工具也支持由对象类型驱动的创建命令。 这些命令支持更多的对象类型,并且对其意图更为明确,但要求用户知道他们打算创建的对象的类型。
- `create <objecttype> [<subtype>] <instancename>`
某些对象类型具有您可以在“create"命令中指定的子类型。例如,Service对象有ClusterIPLoadBalancer和NodePort等几种子类型。以下是使用子类型NodePort创建一个服务的示例:
```shell
kubectl create service nodeport <myservicename>
```
在前面的例子中, `create service nodeport`命令叫做 `create service`命令的子命令.
您可以使用 `-h` 标志来查找子命令支持的参数和标志:
```shell
kubectl create service nodeport -h
```
## 如何更新对象
`kubectl` 命令支持一些常见更新操作的动词驱动命令。这些命令的命名方式可以让不熟悉 Kubernetes 对象的用户,在不知道必须设置的特定字段的情况下也可以执行更新操作:
- `scale`: 通过更新控制器的副本数量,水平扩展控制器以添加或删除 Pod。
- `annotate`: 从对象添加或删除注释。
- `label`: 为对象添加或删除标签。
`kubectl`命令还支持由对象的一个​​切面驱动的更新命令.设置此切面可能会为不同的对象类型设置不同的字段:
- `set` <field>: 设置对象的一个​​切面。
**注**: 在 Kubernetes 版本 1.5 中,并不是每个动词驱动的命令都有一个相关的切面驱动的命令。
`kubectl` 工具支持直接更新活动对象的其他方法,然而,它们需要更好的了解 Kubernetes 对象模式。
- `edit`: 通过在编辑器中打开其配置,直接编辑活动对象的原始配置。
- `patch`: 通过使用补丁字符串直接修改活动对象的特定字段。
有关补丁字符串的更多详细信息,请参阅补丁部分
[API 公约](https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#patch-operations)。
## 如何删除对象
您可以使用 `delete` 命令从集群中删除一个对象:
- `delete <type>/<name>`
**注意**: 您可以对命令式命令和命令式对象配置都使用 `kubectl delete` 方法。两者的差异在于传递的命令参数不同。要将
`kubectl delete` 作为命令式命令使用,需将要删除的对象作为参数传递。以下是传递名为 nginx 的 Deployment 对象的示例:
```shell
kubectl delete deployment/nginx
```
## 如何查看对象
{{< comment >}}
TODO(pwittrock): 实现时取消注释。
您可以使用 `kubectl view` 打印对象的指定字段。
- `view`: 打印对象的特定字段的值。
{{< /comment >}}
有几个命令用于打印有关对象的信息:
- `get`: 打印有关匹配对象的基本信息。使用 `get -h` 来查看选项列表。
- `describe`: 打印有关匹配对象的聚合详细信息。
- `logs`: 打印 Pod 运行容器的 stdout 和 stderr 信息。
## 使用 `set` 命令在创建之前修改对象
有一些对象字段没有可以在 `create` 命令中使用的标志。在某些情况下,您可以组合使用 `set``create` 在对象创建之前指定字段的值。这是通过将 `create` 命令的输出管道连接到 `set` 命令,然后回到 `create` 命令。以下是一个例子:
```sh
kubectl create service clusterip <myservicename> -o yaml --dry-run | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -
```
1. 使用 `create service -o yaml --dry-run` 创建服务配置,并将其作为 YAML 打印到 stdout,而不是将其发送到 Kubernetes API 服务器。
1. 使用 `set --local -f - -o yaml` 从 stdin 读取配置,并将更新后的配置作为 YAML 写入 stdout。
1. 使用 `kubectl create -f -` 从 stdin 提供的配置创建对象。
## 使用 `--edit` 在创建之前修改对象
您可以使用 `kubectl create --edit` 命令在对象创建之前,对对象进行任意更改。以下是一个例子:
```sh
kubectl create service clusterip my-svc -o yaml --dry-run > /tmp/srv.yaml
kubectl create --edit -f /tmp/srv.yaml
```
1. 使用`create service` 创建服务的配置并将其保存到 `/tmp/srv.yaml`
1. 使用`create --edit` 在创建对象之前打开配置文件进行编辑。
{{% /capture %}}
{{% capture whatsnext %}}
- [使用对象配置管理 Kubernetes 对象(必要)](/docs/tutorials/object-management-kubectl/imperative-object-management-configuration/)
- [使用对象配置(声明式)管理 Kubernetes 对象](/docs/tutorials/object-management-kubectl/declarative-object-management-configuration/)
- [Kubectl 命令参考](/docs/user-guide/kubectl/v1.6/)
- [Kubernetes 对象模式参考](/docs/resources-reference/v1.6/)
{{% /capture %}}
@@ -0,0 +1,153 @@
---
title: Kubernetes 对象管理
content_template: templates/concept
---
{{% capture overview %}}
`kubectl` 命令行工具支持 Kubernetes 对象几种不同的创建和管理方法。本文档简要介绍了这些方法.
{{% /capture %}}
{{% capture body %}}
## 管理技巧
**警告:** Kubernetes 对象应该只使用一种技术进行管理。混合使用不同的技术,会导致相同对象出现未定义的行为。
| 管理技术 | 操作 |推荐环境 | 支持撰写 | 学习曲线 |
|----------------------------------|----------------------|------------------------|--------------------|----------------|
| 命令式的方式 | 活动对象 | 开发项目 | 1+ | 最低 |
| 命令式对象配置 | 单文件 | 生产项目 | 1 | 中等 |
| 声明式对象配置 | 文件目录 | 生产项目 | 1+ | 最高 |
## 命令式的方式
当使用命令式的命令时,用户直接对集群中的活动对象进行操作。用户提供 `kubectl` 命令的参数或标记进行操作。
这是在集群中启动或运行一次性任务的最简单的方法。因为这种技术直接在活动对象上运行,所以它没有提供以前配置的历史记录。
### 例子
通过创建 Deployment 对象来运行 nginx 容器的实例:
```sh
kubectl run nginx --image nginx
```
使用不同的语法做同样的事情:
```sh
kubectl create deployment nginx --image nginx
```
### 权衡
与对象配置相比的优点:
- 命令简单易学,易于记忆。
- 命令只需要一个步骤即可对群集进行更改。
与对象配置相比的缺点:
- 命令不与变更审核流程整合。
- 命令不提供与更改相关联的审计跟踪。
- 除了活动对象之外,命令不提供记录来源。
- 命令不提供用于创建新对象的模板。
## 命令式对象配置
在命令式对象配置中,`kubectl` 命令指定操作(创建,替换等),可选标志和至少一个文件名称。指定的文件必须包含对象的完整定义以 YAML 或 JSON 格式。
请参阅[参考资源](https://kubernetes.io/docs/resources-reference/v1.6/)
查看有关对象定义的更多细节。
**警告:** 命令式 `replace` 命令用新提供的命令替换现有资源规格,将对配置文件中缺少的对象的所有更改都丢弃。这种方法不应更新与配置文件无关的资源类型。例如,`LoadBalancer` 类型的服务使其 `externalIPs` 字段与集群的配置无关。
### 例子
创建对象定义配置文件:
```sh
kubectl create -f nginx.yaml
```
删除两个配置文件中定义的对象:
```sh
kubectl delete -f nginx.yaml -f redis.yaml
```
通过覆写实时配置更新配置文件中定义的对象:
```sh
kubectl replace -f nginx.yaml
```
### 权衡
与命令式的命令相比的优点:
- 对象配置可以存储在源码控制系统中,如Git。
- 对象配置可以与进程集成,例如在推送和审计跟踪之前查看更改。
- 对象配置提供了一个用于创建新对象的模板。
与命令式的命令相比的缺点:
- 对象配置需要对对象模式有基本的了解。
- 对象配置需要编写 YAML 文件的附加步骤。
与声明式对象配置相比的优势:
- 命令对象配置行为更简单易懂。
- 至于 Kubernetes 1.5 版本,命令式对象配置更为成熟。
与声明式对象配置相比的缺点:
- 命令对象配置最适合于文件,而不是目录。
- 活动对象的更新必须反映在配置文件中,否则在下次更替时将丢失。
## 声明式对象配置
当使用声明式对象配置时,用户对本地存储的对象配置文件进行操作,但是用户没有定义要对文件执行的操作。通过 `kubectl` 自动检测每个对象进行创建、更新和删除操作。这样可以在目录层级上工作,因为不同的对象可能需要不同的操作。
**注意:** 声明式对象配置保留由其他对象进行的更改,即使更改未合并到对象配置文件中。这可以通过使用 `patch` API 操作来写入观察到的差异,而不是使用`replace` API 操作来替换整个对象的配置。
### 例子
处理`configs` 目录中的所有对象配置文件,创建或修补(patch)活动对象:
```sh
kubectl apply -f configs/
```
递归处理目录:
```sh
kubectl apply -R -f configs/
```
### 权衡
与命令式对象配置相比的优点:
- 直接对活动对象进行的更改将被保留,即使它们未被并入到配置文件中。
- 声明式对象配置更好地支持目录操作,并自动检测每个对象的操作类型 (创建、修补,删除)。
与命令式对象配置相比的缺点:
- 声明式对象配置在意外情况下难以调试和了解结果。
- 使用差异的部分更新会创建复杂的合并和补丁操作。
{{% /capture %}}
{{% capture whatsnext %}}
- [使用命令式的命令管理 Kubernetes 对象](/docs/tutorials/object-management-kubectl/imperative-object-management-command/)
- [使用对象配置管理 Kubernetes 对象(必要)](/docs/tutorials/object-management-kubectl/imperative-object-management-configuration/)
- [使用对象配置(声明式)管理 Kubernetes 对象](/docs/tutorials/object-management-kubectl/declarative-object-management-configuration/)
- [Kubectl 命令参考](/docs/user-guide/kubectl/v1.6/)
- [Kubernetes 对象模式参考](/docs/resources-reference/v1.6/)
{{< comment >}}
{{< /comment >}}
{{% /capture %}}