From 25eb8099e5bf081e8553e0aa8be02018e84182e1 Mon Sep 17 00:00:00 2001 From: jianglingxia Date: Thu, 14 Sep 2017 14:16:28 +0800 Subject: [PATCH 01/18] delete ConfigMap in secret --- docs/concepts/configuration/secret.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/concepts/configuration/secret.md b/docs/concepts/configuration/secret.md index 102eee8648..900ff46077 100644 --- a/docs/concepts/configuration/secret.md +++ b/docs/concepts/configuration/secret.md @@ -442,7 +442,7 @@ that are considered invalid environment variable names will have those keys skipped. The pod will be allowed to start. There will be an event whose reason is `InvalidVariableNames` and the message will contain the list of invalid keys that were skipped. The example shows a pod which refers to the -default/mysecret ConfigMap that contains 2 invalid keys, 1badkey and 2alsobad. +default/mysecret that contains 2 invalid keys, 1badkey and 2alsobad. ```shell $ kubectl get events From 2c54dff8a1df12dafc31789ded859313f438ab0d Mon Sep 17 00:00:00 2001 From: zhangmingld Date: Wed, 20 Sep 2017 11:02:10 +0800 Subject: [PATCH 02/18] ZTE-SH-CN-example-concept-template.md translate /docs/concepts/example-concept-template --- cn/docs/concepts/example-concept-template.md | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 cn/docs/concepts/example-concept-template.md diff --git a/cn/docs/concepts/example-concept-template.md b/cn/docs/concepts/example-concept-template.md new file mode 100644 index 0000000000..ae33aea1f2 --- /dev/null +++ b/cn/docs/concepts/example-concept-template.md @@ -0,0 +1,36 @@ +--- +title: 概念模板示例 +approvers: +- chenopis +--- + +{% capture overview %} + +**注意:** 注意为新文档 [create an entry in the table of contents](/docs/home/contribute/write-new-topic/#creating-an-entry-in-the-table-of-contents) 。 + +本页解释了 ... + +{% endcapture %} + +{% capture body %} + +## 了解 ... + +Kubernetes 提供 ... + +## 使用 ... + +使用 ... + +{% endcapture %} + +{% capture whatsnext %} + +**[可选章节]** + +* 了解更多 [Writing a New Topic](/docs/home/contribute/write-new-topic/)。 +* 查看 [Using Page Templates - Concept template](/docs/home/contribute/page-templates/#concept_template) 了解如何使用本模板。 + +{% endcapture %} + +{% include templates/concept.md %} From 94f8bfbeed179f1b9c43b822a43e7c5a87e22d31 Mon Sep 17 00:00:00 2001 From: jianglingxia Date: Thu, 21 Sep 2017 15:57:21 +0800 Subject: [PATCH 03/18] some error in statefulset --- .../stateful-application/basic-stateful-set.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/docs/tutorials/stateful-application/basic-stateful-set.md b/docs/tutorials/stateful-application/basic-stateful-set.md index 5d94890127..1c644dd519 100644 --- a/docs/tutorials/stateful-application/basic-stateful-set.md +++ b/docs/tutorials/stateful-application/basic-stateful-set.md @@ -262,8 +262,7 @@ www-web-0 Bound pvc-15c268c7-b507-11e6-932f-42010a800002 1Gi RWO www-web-1 Bound pvc-15c79307-b507-11e6-932f-42010a800002 1Gi RWO 48s ``` The StatefulSet controller created two PersistentVolumeClaims that are -bound to two [PersistentVolumes](/docs/concepts/storage/volumes/). As the -cluster used in this tutorial is configured to dynamically provision +bound to two [PersistentVolumes](/docs/concepts/storage/persistent-volumes/). As the cluster used in this tutorial is configured to dynamically provision PersistentVolumes, the PersistentVolumes were created and bound automatically. The NGINX webservers, by default, will serve an index file at @@ -330,7 +329,7 @@ web-1 Even though `web-0` and `web-1` were rescheduled, they continue to serve their hostnames because the PersistentVolumes associated with their -PersistentVolumeClaims are remounted to their `volumeMount`s. No matter what +PersistentVolumeClaims are remounted to their `volumeMounts`. No matter what node `web-0`and `web-1` are scheduled on, their PersistentVolumes will be mounted to the appropriate mount points. @@ -338,8 +337,7 @@ mounted to the appropriate mount points. Scaling a StatefulSet refers to increasing or decreasing the number of replicas. This is accomplished by updating the `replicas` field. You can use either [`kubectl scale`](/docs/user-guide/kubectl/{{page.version}}/#scale) or -[`kubectl patch`](/docs/user-guide/kubectl/{{page.version}}/#patch) to scale a Stateful -Set. +[`kubectl patch`](/docs/user-guide/kubectl/{{page.version}}/#patch) to scale a StatefulSet. ### Scaling Up @@ -440,10 +438,7 @@ www-web-4 Bound pvc-e11bb5f8-b508-11e6-932f-42010a800002 1Gi RWO ``` There are still five PersistentVolumeClaims and five PersistentVolumes. -When exploring a Pod's [stable storage](#stable-storage), we saw that the -PersistentVolumes mounted to the Pods of a StatefulSet are not deleted when -the StatefulSet's Pods are deleted. This is still true when Pod deletion is -caused by scaling the StatefulSet down. +When exploring a Pod's [stable storage](#writing-to-stable-storage), we saw that the PersistentVolumes mounted to the Pods of a StatefulSet are not deleted whenthe StatefulSet's Pods are deleted. This is still true when Pod deletion is caused by scaling the StatefulSet down. ## Updating StatefulSets From 18254f4413f1a8eaa24ccd8ae278b702309aba78 Mon Sep 17 00:00:00 2001 From: jianglingxia Date: Thu, 21 Sep 2017 17:27:41 +0800 Subject: [PATCH 04/18] another error --- docs/tutorials/stateful-application/basic-stateful-set.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/tutorials/stateful-application/basic-stateful-set.md b/docs/tutorials/stateful-application/basic-stateful-set.md index 1c644dd519..f291e8b997 100644 --- a/docs/tutorials/stateful-application/basic-stateful-set.md +++ b/docs/tutorials/stateful-application/basic-stateful-set.md @@ -795,8 +795,7 @@ continue the update process. ## Deleting StatefulSets StatefulSet supports both Non-Cascading and Cascading deletion. In a -Non-Cascading Delete, the StatefulSet's Pods are not deleted when the Stateful -Set is deleted. In a Cascading Delete, both the StatefulSet and its Pods are +Non-Cascading Delete, the StatefulSet's Pods are not deleted when the StatefulSet is deleted. In a Cascading Delete, both the StatefulSet and its Pods are deleted. ### Non-Cascading Delete @@ -940,7 +939,7 @@ web-1 0/1 Terminating 0 29m ``` -As you saw in the [Scaling Down](#ordered-pod-termination) section, the Pods +As you saw in the [Scaling Down](#scaling-down) section, the Pods are terminated one at a time, with respect to the reverse order of their ordinal indices. Before terminating a Pod, the StatefulSet controller waits for the Pod's successor to be completely terminated. From 685ea833ac0493830bcdc66df3e3fbbe53b59322 Mon Sep 17 00:00:00 2001 From: Steve Perry Date: Thu, 21 Sep 2017 19:45:39 -0700 Subject: [PATCH 05/18] Experiment: Add trailing slash to one redirect target. (#5576) --- _redirects | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_redirects b/_redirects index 3ecb6d04c4..217484f75d 100644 --- a/_redirects +++ b/_redirects @@ -147,7 +147,9 @@ /docs/user-guide/connecting-to-applications-proxy /docs/tasks/access-kubernetes-api/http-proxy-access-api 301 /docs/user-guide/container-environment /docs/concepts/containers/container-lifecycle-hooks 301 /docs/user-guide/cron-jobs /docs/concepts/workloads/controllers/cron-jobs 301 -/docs/user-guide/debugging-pods-and-replication-controllers /docs/tasks/debug-application-cluster/debug-pod-replication-controller 301 + +/docs/user-guide/debugging-pods-and-replication-controllers/ /docs/tasks/debug-application-cluster/debug-pod-replication-controller/ 301 + /docs/user-guide/debugging-services /docs/tasks/debug-application-cluster/debug-service 301 /docs/user-guide/deploying-applications /docs/tasks/run-application/run-stateless-application-deployment 301 /docs/user-guide/deployments /docs/concepts/workloads/controllers/deployment 301 From d2a4a6cdbb385f48bc6f0dcac295e955158a8c47 Mon Sep 17 00:00:00 2001 From: Steve Perry Date: Thu, 21 Sep 2017 20:15:19 -0700 Subject: [PATCH 06/18] Experiment: Fix one link that currently gets redirected. (#5577) --- docs/tasks/debug-application-cluster/debug-stateful-set.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/tasks/debug-application-cluster/debug-stateful-set.md b/docs/tasks/debug-application-cluster/debug-stateful-set.md index 57717228d5..070141ec97 100644 --- a/docs/tasks/debug-application-cluster/debug-stateful-set.md +++ b/docs/tasks/debug-application-cluster/debug-stateful-set.md @@ -34,7 +34,8 @@ In order to list all the pods which belong to a StatefulSet, which have a label kubectl get pods -l app=myapp ``` -If you find that any Pods listed are in `Unknown` or `Terminating` state for an extended period of time, refer to the [Deleting StatefulSet Pods](/docs/tasks/manage-stateful-set/delete-pods/) task for instructions on how to deal with them. You can debug individual Pods in a StatefulSet using the [Debugging Pods](/docs/user-guide/debugging-pods-and-replication-controllers/#debugging-pods) guide. +If you find that any Pods listed are in `Unknown` or `Terminating` state for an extended period of time, refer to the [Deleting StatefulSet Pods](/docs/tasks/manage-stateful-set/delete-pods/) task for instructions on how to deal with them. You can debug individual Pods in a StatefulSet using the +[Debugging Pods](/docs/tasks/debug-application-cluster/debug-pod-replication-controller/#debugging-pods) guide. StatefulSets provide a debug mechanism to pause all controller operations on Pods using an annotation. Setting the `pod.alpha.kubernetes.io/initialized` annotation to `"false"` on any StatefulSet Pod will *pause* all operations of the StatefulSet. When paused, the StatefulSet will not perform any scaling operations. Once the debug hook is set, you can execute commands within the containers of StatefulSet pods without interference from scaling operations. You can set the annotation to `"false"` by executing the following: From 00f4aab96af47aa9d40bdb857e4db6e1b8143227 Mon Sep 17 00:00:00 2001 From: zhengjiajin Date: Fri, 22 Sep 2017 16:51:04 +0800 Subject: [PATCH 07/18] k8smeetup-kubectl-overview-2017-7-15 --- cn/docs/user-guide/kubectl-overview.md | 289 +++++++++++++++++++++++++ 1 file changed, 289 insertions(+) create mode 100644 cn/docs/user-guide/kubectl-overview.md diff --git a/cn/docs/user-guide/kubectl-overview.md b/cn/docs/user-guide/kubectl-overview.md new file mode 100644 index 0000000000..ef90b69247 --- /dev/null +++ b/cn/docs/user-guide/kubectl-overview.md @@ -0,0 +1,289 @@ +--- +approvers: +- bgrant0607 +- hw-qiaolei +title:kubectl概述 +--- +kubectl是用于针对Kubernetes集群运行命令的命令行接口。本概述涵盖`kubectl`语法,描述命令操作,并提供常见的示例。有关每个命令的详细信息,包括所有支持的flags和子命令,请参考[kubectl](/docs/user-guide/kubectl)相关文档。有关安装说明,请参阅[安装kubectl](/docs/tasks/kubectl/install/)。 + +## 语法 +从您的终端窗口使用以下语法运行`kubectl`命令: + +```shell +kubectl [command] [TYPE] [NAME] [flags] +``` + +其中command,TYPE,NAME,和flags分别是: + +* `command`: 指定要在一个或多个资源进行操作,例如`create`,`get`,`describe`,`delete`。 + +* `TYPE`:指定[资源类型](#资源类型)。资源类型区分大小写,您可以指定单数,复数或缩写形式。例如,以下命令产生相同的输出: + + $ kubectl get pod pod1 + $ kubectl get pods pod1 + $ kubectl get po pod1 + +`NAME`:指定资源的名称。名称区分大小写。如果省略名称,则会显示所有资源的详细信息,比如`$ kubectl get pods`。 + + 在多个资源上执行操作时,可以按类型和名称指定每个资源,或指定一个或多个文件: + + * 按类型和名称指定资源: + + * 要分组资源,如果它们都是相同的类型:`TYPE1 name1 name2 name<#>`.
+ 例: `$ kubectl get pod example-pod1 example-pod2` + + * 要分别指定多种资源类型: `TYPE1/name1 TYPE1/name2 TYPE2/name3 TYPE<#>/name<#>`.
+ 例: `$ kubectl get pod/example-pod1 replicationcontroller/example-rc1` + + 使用一个或多个文件指定资源: `-f file1 -f file2 -f file<#>` 使用[YAML而不是JSON](/docs/concepts/configuration/overview/#general-config-tips),因为YAML往往更加用户友好,特别是对于配置文件。
+ 例:$ kubectl get pod -f ./pod.yaml + +* flags:指定可选标志。例如,您可以使用`-s`或`--serverflags`来指定Kubernetes API服务器的地址和端口。 +**重要提示**:从命令行指定的标志将覆盖默认值和任何相应的环境变量。 + +如果您需要帮助,只需从终端窗口运行`kubectl help`。 + +## 操作 + +下表包括所有kubectl操作的简短描述和一般语法: + +Operation | Syntax | Description +-------------------- | -------------------- | -------------------- +`annotate` | `kubectl annotate (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags]` | 添加或更新一个或多个资源的注解。 +`api-versions` | `kubectl api-versions [flags]` | 列出可用的API版本。 +`apply` | `kubectl apply -f FILENAME [flags]`| 对文件或标准输入流更改资源应用配置。 +`attach` | `kubectl attach POD -c CONTAINER [-i] [-t] [flags]` | attach 到正在运行的容器来查看输出流或与容器(stdin)进行交互。 +`autoscale` | `kubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags]` | 自动弹性伸缩一组被replication controller管理的pods。 +`cluster-info` | `kubectl cluster-info [flags]` | 显示有关集群中master节点和服务的端点信息。 +`config` | `kubectl config SUBCOMMAND [flags]` | 修改kubeconfig文件。有关详细信息,请参阅各个子命令。 +`create` | `kubectl create -f FILENAME [flags]` | 从文件或stdin创建一个或多个资源。 +`delete` | `kubectl delete (-f FILENAME | TYPE [NAME | /NAME | -l label | --all]) [flags]` | 从文件,stdin或指定selector,名称,资源选择器或资源中删除资源。 +`describe` | `kubectl describe (-f FILENAME | TYPE [NAME_PREFIX | /NAME | -l label]) [flags]` | 显示一个或多个资源的详细状态。 +`edit` | `kubectl edit (-f FILENAME | TYPE NAME | TYPE/NAME) [flags]` | 使用默认编辑器编辑和更新服务器上一个或多个资源的定义。 +`exec` | `kubectl exec POD [-c CONTAINER] [-i] [-t] [flags] [-- COMMAND [args...]]` | 对pod中的容器执行命令 +`explain` | `kubectl explain [--include-extended-apis=true] [--recursive=false] [flags]` | 获取各种资源的文档。例如 pods, nodes, services 等. +`expose` | `kubectl expose (-f FILENAME | TYPE NAME | TYPE/NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [----external-ip=external-ip-of-service] [--type=type] [flags]` | 将暴露replication controller, service, 或者pod为新的Kubernetes服务。 +`get` | `kubectl get (-f FILENAME | TYPE [NAME | /NAME | -l label]) [--watch] [--sort-by=FIELD] [[-o | --output]=OUTPUT_FORMAT] [flags]` | 列出一个或多个资源。 +`label` | `kubectl label (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags]` | 添加或更新一个或多个资源的标签 +`logs` | `kubectl logs POD [-c CONTAINER] [--follow] [flags]` | 在pod的容器中打印日志。 +`patch` | `kubectl patch (-f FILENAME | TYPE NAME | TYPE/NAME) --patch PATCH [flags]` | 使用strategic merge patch程序更新资源的一个或多个字段。 +`port-forward` | `kubectl port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] [flags]` | 将一个或多个本地端口转发到pod。 +`proxy` | `kubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix] [flags]` | 运行一个代理到Kubernetes API服务器。 +`replace` | `kubectl replace -f FILENAME` | 从文件或stdin替换资源。 +`rolling-update` | `kubectl rolling-update OLD_CONTROLLER_NAME ([NEW_CONTROLLER_NAME] --image=NEW_CONTAINER_IMAGE | -f NEW_CONTROLLER_SPEC) [flags]` | 通过逐步替换指定的replication controller及其pod来执行滚动更新。 +`run` | `kubectl run NAME --image=image [--env="key=value"] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json] [flags]` | 在集群上运行指定的镜像。 +`scale` | `kubectl scale (-f FILENAME | TYPE NAME | TYPE/NAME) --replicas=COUNT [--resource-version=version] [--current-replicas=count] [flags]` | 更新指定replication controller的副本数量。 +`stop` | `kubectl stop` | 已弃用: 相应的, 请查看 `kubectl delete`. +`version` | `kubectl version [--client] [flags]` | 显示在客户端和服务器上运行的Kubernetes版本。 + +请记住:有关命令操作的更多信息,请参阅[kubectl](/docs/user-guide/kubectl)参考文档。 + +## 资源类型 + +下表包括所有支持的资源类型及其缩写别名的列表: + +资源类型 | 缩写别名 +-------------------- | -------------------- +`apiservices` | +`certificatesigningrequests` |`csr` +`clusters` | +`clusterrolebindings` | +`clusterroles` | +`componentstatuses` |`cs` +`configmaps` |`cm` +`controllerrevisions` | +`cronjobs` | +`customresourcedefinition` |`crd` +`daemonsets` |`ds` +`deployments` |`deploy` +`endpoints` |`ep` +`events` |`ev` +`horizontalpodautoscalers` |`hpa` +`ingresses` |`ing` +`jobs` | +`limitranges` |`limits` +`namespaces` |`ns` +`networkpolicies` |`netpol` +`nodes` |`no` +`persistentvolumeclaims` |`pvc` +`persistentvolumes` |`pv` +`poddisruptionbudget` |`pdb` +`podpreset` | +`pods` |`po` +`podsecuritypolicies` |`psp` +`podtemplates` | +`replicasets` |`rs` +`replicationcontrollers` |`rc` +`resourcequotas` |`quota` +`rolebindings` | +`roles` | +`secrets` | +`serviceaccounts` |`sa` +`services` |`svc` +`statefulsets` | +`storageclasses` | + +## 输出选项 +请使用以下部分查看如何格式化或排序某些命令的输出的信息,有关哪些命令支持各种输出选项的详细信息,请参阅[kubectl](/docs/user-guide/kubectl)参考文档。 + +### 格式化输出 + +所有kubectl命令的默认输出格式是可读的纯文本格式。要以特定格式将详细信息输出到终端窗口,您可以将一个`-o`或多个`-output`标志添加到支持的`kubectl`命令中。 + +#### 语法 + +```shell +kubectl [command] [TYPE] [NAME] -o= +``` + +根据kubectl操作,支持以下输出格式: + +输出格式 | 描述 +--------------| ----------- +`-o=custom-columns=` | 输入使用逗号分隔的列表打印表格 [custom columns](#custom-columns)。 +`-o=custom-columns-file=` | 使用文件中的[自定义列模板](#custom-columns)打印表``。 +`-o=json` | 输出JSON格式的API对象。 +`-o=jsonpath=