Merge release 1.12 into release 1.13 (#14171)

* ZH-trans: Update coarse-parallel-processing-work-queue.md (#11862)

* ZH-trans: Update coarse-parallel-processing-work-queue.md

* Update coarse-parallel-processing-work-queue.md

* zh-trans: add /docs/concepts/architecture/cloud-controller.md (#11799)

* docs/concepts/architecture/cloud-controller.md

* docs/concepts/architecture/cloud-controller.md

* docs/concepts/architecture/cloud-controller.md

* fix

* fix

* fix

* zh-trans: /docs/contribute/style/kubernetes-components.md (#11838)

Signed-off-by: liyuan198251 <li.yuan4@zte.com.cn>

zh-trans: /docs/contribute/generate-ref-docs/kubernetes-components.md; update

Signed-off-by: liyuan198251 <li.yuan4@zte.com.cn>

* Update weave-network-policy.md (#11858)

* ZH-trans: add Update define-environment-variable-container.md (#11859)

* Update define-environment-variable-container.md

* Update define-environment-variable-container.md

* Update define-environment-variable-container.md

* Update define-environment-variable-container.md

* Update define-environment-variable-container.md

* Update fine-parallel-processing-work-queue.md (#11863)

* Update fine-parallel-processing-work-queue.md

* Update fine-parallel-processing-work-queue.md

* Update setup-extension-api-server.md (#11864)

* zh-trans: add / docs/reference/setup-tools/kubeadm/kubeadm-join.md (#11798)

* zh-trans: add / docs/reference/setup-tools/kubeadm/kubeadm-join.md

zh-trans: add / docs/reference/setup-tools/kubeadm/kubeadm-join.md

* Update kubeadm-join.md

* Create kubeadm_join.md

* zh-trans: update docs/concepts/containers/images.md (#11877)

* zh-trans: update docs/concepts/containers/images.md

* zh-trans: update docs/concepts/containers/images.md

* Update kubeadm_alpha_phase_controlplane.md (#11878)

* 更新第 115 行翻译

* zh_trans: kubeadm_token_generate.md (#11884)

* zh_trans: kubeadm_token_generate.md

zh_trans: /docs/reference/setup-tools/kubeadm/generated/kubeadm_token_generate.md

* Better translation  

Better translation
 

* zh-trans: add /docs/tasks/configure-pod-container/configure-pod-initialization.md (#11886)

zh-trans: add /docs/tasks/configure-pod-container/configure-pod-initialization.md

* zh-trans:add content/zh/docs/reference/issues-security (#11890)

* zh-trans: add content/zh/docs/tutorials/online-training/overview.md (#11892)

* zh_trans: kubeadm_token_delete.md (#11883)

* zh_trans: kubeadm_token_delete.md

zh_trans: /docs/reference/setup-tools/kubeadm/generated/kubeadm_token_create.md

* fix tpye error

fix tpye error

*  Better translation  

Better translation

* zh_trans: independent/create-cluster-kubeadm.md (#11882)

* zh_trans: independent/create-cluster-kubeadm.md

zh_trans: docs/setup/independent/create-cluster-kubeadm.md

* fix word style error

* fix type error

* better zhtran

better zhtran

* fix "Create" -> "create"

fix "Create" -> "create"

* zh-trans: add docs⁩/concept⁨s/storage/storage-classes.md (#11788)

* ZH-trans: fixing formatting errors (#11661)

* ZH-trans: fixing formatting errors

* Update ZH-trans: fixing formatting errors

storage-classes zh part 1

* storage-classes zh trans

* fix typo

update trans for provisioner & fix typo

* fix typo

* 根据校对更新翻译

* zh_trans: kubeadm-token.md (#11898)

zh_trans: /docs/reference/setup-tools/kubeadm/kubeadm-token.md

* zh-trans: add /docs/tasks/configure-pod-container/quality-service-pod.md (#11900)

* zh-trans: add /docs/tasks/configure-pod-container/quality-service-pod.md

zh-trans: add /docs/tasks/configure-pod-container/quality-service-pod.md

* Update quality-service-pod.md

* zh_trans: kubeadm_alpha_phase_bootstrap-token_node.md (#11897)

zh_trans: Path:/docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_phase_bootstrap-token_node.md

* zh-trans: add /docs/concepts/storage/volumes.md (#11767)

* zh-trans: add /docs/concepts/storage/volumes.md

zh-trans: add /docs/concepts/storage/volumes.md

* Update volumes.md

* Update volumes.md

* self-review

* Update volumes.md

* fix docs format error (#11934)

fix docs format error of https://v1-12.docs.kubernetes.io/zh/docs/reference/setup-tools/kubeadm/kubeadm-join/

* Update cloud-controller.md (#11922)

* zh-trans: /docs/reference/glossary/approver.md (#11924)

zh-trans: /docs/reference/glossary/approver.md

* zh-trans: add docs/setup/on-premises-vm/dcos.md (#11891)

* zh-trans: add docs/setup/on-premises-vm/dcos.md

* Update content/zh/docs/setup/on-premises-vm/dcos.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* zh-trans: /docs/tasks/configure-pod-container/configure-persistent-vo… (#11915)

* zh-trans: /docs/tasks/configure-pod-container/configure-persistent-volume-storage.md

zh-trans: /docs/tasks/configure-pod-container/configure-persistent-volume-storage.md

* Update configure-persistent-volume-storage.md

* zh_trans: kubeadm_alpha.md (#11902)

* zh_trans: kubeadm_alpha.md

zh_trans: /docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha.md

* Better translation

Better translation

* zh-trans: /docs/reference/glossary/downstream.md (#11931)

* zh-trans: /docs/reference/glossary/downstream.md

zh-trans: /docs/reference/glossary/downstream.md

* Update downstream.md

* Update downstream.md

* ZH-trans: Update install-kubeadm.md (#11955)

* fix typo of install-kubeadm.md

fix typo of install-kubeadm.md

* Update install-kubeadm.md

* zh-trans: add kubeadm/generated/kubeadm_alpha_phase_certs_renew_all.md (#11952)

* zh-trans: add /docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_phase_certs_renew_all.md

zh-trans: add /docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_phase_certs_renew_all.md

* Update kubeadm_alpha_phase_certs_renew_all.md

* renew 的翻译更新为续期

* zh-trans:kubeadm/generated/kubeadm_alpha_phase_certs_renew_etcd-peer.md (#11953)

* zh-trans:/docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_phase_certs_renew_etcd-peer.md

/docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_phase_certs_renew_etcd-peer.md

* Update kubeadm_alpha_phase_certs_renew_etcd-peer.md

* zh-trans: /docs/contribute/generate-ref-docs/kubectl.md (#11941)

Signed-off-by: liyuan198251 <li.yuan4@zte.com.cn>

* fix docs format error (#11936)

fix docs format error of https://v1-12.docs.kubernetes.io/zh/docs/reference/setup-tools/kubeadm/kubeadm-config/

* Update pull request (#11921)

* Update pull request (#11960)

* ZH-trans: add kubefed-options.md (#11956)

* Update ZH-trans: add kubefed-options.md

* Update kubefed-options.md

* ZH-trans: add generated/... (#11880)

* Update pull request

* Update kubeadm_alpha_phase_certs_renew.md

* Update pull request (#11881)

* ZH-trans: add generated/... (#11879)

* Update pull request

* Resolving file conflicts

* zh-trans: add zh/ docs/tasks/configure-pod-container/configure-servic… (#11889)

* zh-trans: add zh/ docs/tasks/configure-pod-container/configure-service-account.md

zh-trans: add zh/ docs/tasks/configure-pod-container/configure-service-account.md

* Update configure-service-account.md

* Update configure-service-account.md

* zh-trans: update docs/concepts/cluster-administration/kubelet-garbage-collection.md (#11875)

* zh-trans: update docs/concepts/cluster-administration/kubelet-garbage-collection.md

* zh-trans: update docs/concepts/cluster-administration/kubelet-garbage-collection.md

* zh-trans:update kubelet-garbage-collection.md

* zh_trans: kubeadm_alpha_phase_kubeconfig_user.md (#11901)

* zh_trans: kubeadm_alpha_phase_kubeconfig_user.md

zh_trans: /docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_phase_kubeconfig_user.md

* Better translation

* zh-trans:add docs/reference/using-api/client-libraries.md (#11958)

* zh-trans:add docs/reference/using-api/client-libraries.md

* Update content/zh/docs/reference/using-api/client-libraries.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* zh-trans: add pull-image-private-registry.md (#11912)

* zh-trans: add pull-image-private-registry.md

zh-trans: add pull-image-private-registry.md

* Update pull-image-private-registry.md

* Update pull-image-private-registry.md

* ZH-trans: add kubeadm_alpha_phase_kubelet_config_annotate-cri.md (#11972)

* Create kubeadm_alpha_phase_kubelet_config_annotate-cri.md

* Update kubeadm_alpha_phase_kubelet_config_annotate-cri.md

* ZH-trans: add kubeadm_alpha_phase_kubelet_config.md (#11974)

* Create kubeadm_alpha_phase_kubelet_config.md

* Update kubeadm_alpha_phase_kubelet_config.md

* fix Typo "##" -> "## " (#12011)

* fix Typo "##" -> "## "

fix Typo "##" -> "## "

* update basic-stateful-set.md

* fix web style error (#12010)

fix web style error

* Create kubeadm_alpha_phase_selfhosting.md (#12006)

* Create kubeadm_alpha_phase_controlplane_apiserver.md (#12005)

* zh-trans:/docs/tasks/debug-application-cluster/resource-usage-monitor… (#11995)

* zh-trans:/docs/tasks/debug-application-cluster/resource-usage-monitoring.md

zh-trans:/docs/tasks/debug-application-cluster/resource-usage-monitoring.md

* Update resource-usage-monitoring.md

* Update resource-usage-monitoring.md

* zh-trans:/docs/tasks/debug-application-cluster/core-metrics-pipeline.md (#11990)

zh-trans:/docs/tasks/debug-application-cluster/core-metrics-pipeline.md

* zh-trans:/docs/tasks/debug-application-cluster/troubleshooting.md (#11989)

zh-trans:/docs/tasks/debug-application-cluster/troubleshooting.md

* Create kubeadm_alpha_phase_certs_renew_apiserver-kubelet-client.md (#11969)

* Create kubeadm_alpha_phase_certs_renew_apiserver-kubelet-client.md

* Update kubeadm_alpha_phase_certs_renew_apiserver-kubelet-client.md

* zh-trans: /docs/tasks/debug-application-cluster/debug-init-containers.md (#11962)

* zh-trans: /docs/tasks/debug-application-cluster/debug-init-containers.md

zh-trans: /docs/tasks/debug-application-cluster/debug-init-containers.md

* Update debug-init-containers.md

* zh-trans: docs/reference/glossary/horizontal-pod-autoscaler.md (#11930)

* zh-trans: docs/reference/glossary/horizontal-pod-autoscaler.md

zh-trans: docs/reference/glossary/horizontal-pod-autoscaler.md

* Update horizontal-pod-autoscaler.md

* zh-trans: add /docs/tasks/configure-pod-container/configure-projected… (#11911)

* zh-trans: add /docs/tasks/configure-pod-container/configure-projected-volume-storage.md

zh-trans: add /docs/tasks/configure-pod-container/configure-projected-volume-storage.md

* Update configure-projected-volume-storage.md

* Update configure-projected-volume-storage.md

* zh-trans: /docs/tasks/configure-pod-container/extended-resource.md (#11918)

* zh-trans: /docs/tasks/configure-pod-container/extended-resource.md

zh-trans: /docs/tasks/configure-pod-container/extended-resource.md

* Update extended-resource.md

* Update extended-resource.md

* zh-trans: add translate-compose-kubernetes.md (#11910)

* zh-trans: add translate-compose-kubernetes.md

zh-trans: add translate-compose-kubernetes.md

* Update translate-compose-kubernetes.md

* Update translate-compose-kubernetes.md

* Update translate-compose-kubernetes.md

* Update translate-compose-kubernetes.md

* Update translate-compose-kubernetes.md

* Update translate-compose-kubernetes.md

* zh-trans: zh/docs/reference/glossary/flexvolume.md (#11925)

* zh-trans: zh/docs/reference/glossary/flexvolume.md

zh-trans: zh/docs/reference/glossary/flexvolume.md

* Update flexvolume.md

* zh_trans: kubeadm_alpha_phase_bootstrap-token_create.md (#11947)

* zh_trans: kubeadm_alpha_phase_bootstrap-token_create.md

zh_trans: /docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_phase_bootstrap-token_create.md

* better translation  

better translation  

* zh-trans:add docs/setup/turnkey/alibaba-cloud.md (#11959)

* zh_trans: kubeadm_completion.md (#11895)

* zh_trans: kubeadm_completion.md

zh_trans: /docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_phase_bootstrap-token_node.md

* Better translation  

Better translation

* Update kubeadm_completion.md

* better translation

better translation

* zh-trans: add /zh/ docs/tasks/debug-application-cluster/crictl.md (#11961)

* zh-trans: add /zh/ docs/tasks/debug-application-cluster/crictl.md

zh-trans: add /zh/ docs/tasks/debug-application-cluster/crictl.md

* Update crictl.md

* ZH-trans: add kubeadm_alpha_phase_certs_front-proxy-ca.md (#11968)

* ZH-trans: add kubeadm_alpha_phase_controlplane_all.md (#11970)

* Create kubeadm_alpha_phase_controlplane_all.md

* Update kubeadm_alpha_phase_controlplane_all.md

* Update kubeadm_alpha_phase_controlplane_all.md

* Update kubeadm_alpha_phase_controlplane_all.md

* ZH-trans: add kubeadm_alpha_phase_upload-config.md (#11971)

* Create kubeadm_alpha_phase_upload-config.md

* Update kubeadm_alpha_phase_upload-config.md

* Update kubeadm_alpha_phase_upload-config.md

* ZH-trans: Fixed some incorrect translations (#11973)

* zh-trans: /docs/tasks/debug-application-cluster/determine-reason-pod-… (#11977)

* zh-trans: /docs/tasks/debug-application-cluster/determine-reason-pod-failure.md

zh-trans: /docs/tasks/debug-application-cluster/determine-reason-pod-failure.md

* Update determine-reason-pod-failure.md

* zh-trans: /docs/tasks/debug-application-cluster/local-debugging.md (#11988)

* zh-trans: /docs/tasks/debug-application-cluster/local-debugging.md

zh-trans: /docs/tasks/debug-application-cluster/local-debugging.md

* Update local-debugging.md

* zh-trans:/docs/tasks/debug-application-cluster/events-stackdriver.md (#11996)

zh-trans:/docs/tasks/debug-application-cluster/events-stackdriver.md

* zh-trans:/docs/tasks/debug-application-cluster/get-shell-running-cont… (#11998)

* zh-trans:/docs/tasks/debug-application-cluster/get-shell-running-container.md

zh-trans:/docs/tasks/debug-application-cluster/get-shell-running-container.md

* Update get-shell-running-container.md

* zh-trans:/docs/tasks/debug-application-cluster/logging-elasticsearch-kibana.md (#12001)

zh-trans:/docs/tasks/debug-application-cluster/logging-elasticsearch-kibana.md

* ZH-trans: ad kubeadm_alpha_phase_kubelet_config_write-to-disk.md (#12004)

* Create kubeadm_alpha_phase_kubelet_config_write-to-disk.md

* Update kubeadm_alpha_phase_kubelet_config_write-to-disk.md

* Remove old-generated kubefed docs (generated on 25-march-2018) (#12093)

* Update _index.md (#12061)

* Update kubeadm_reset.md (#12047)

* ZH-trasn: add kubeadm_alpha_phase_kubeconfig_controller-manager.md (#12032)

* Create kubeadm_alpha_phase_kubeconfig_controller-manager.md

* Update kubeadm_alpha_phase_kubeconfig_controller-manager.md

* ZH-trans: add kubeadm_alpha_phase_preflight_node.md (#12035)

* Create kubeadm_alpha_phase_preflight_node.md

* Update kubeadm_alpha_phase_preflight_node.md

* Update kubeadm_alpha_phase_preflight_node.md

* ZH-trans: add kubeadm_alpha_phase_controlplane_scheduler.md (#12031)

* Create kubeadm_alpha_phase_controlplane_scheduler.md

* Update kubeadm_alpha_phase_controlplane_scheduler.md

* ZH-trans: add kubeadm_alpha_phase_bootstrap-token_node_allow-post-csrs.md (#12039)

* Create kubeadm_alpha_phase_bootstrap-token_node_allow-post-csrs.md

* Update kubeadm_alpha_phase_bootstrap-token_node_allow-post-csrs.md

* ZH-trans: add kubeadm_alpha_phase_kubelet_write-env-file.md (#12034)

* Create kubeadm_alpha_phase_kubelet_write-env-file.md

* Update kubeadm_alpha_phase_kubelet_write-env-file.md

* ZH-trans: add kubeadm_upgrade_node_experimental-control-plane.md (#12036)

* Create kubeadm_upgrade_node_experimental-control-plane.md

* Update kubeadm_upgrade_node_experimental-control-plane.md

* Create kubeadm_alpha_phase_bootstrap-token_node_allow-auto-approve.md (#12038)

* Create kubeadm_alpha_phase_etcd.md (#12040)

* ZH-trans: add kubeadm_alpha_phase_certs_renew_etcd-server.md (#12041)

* Create kubeadm_alpha_phase_certs_renew_etcd-server.md

* Update kubeadm_alpha_phase_certs_renew_etcd-server.md

* Update advanced.md (#12044)

* ZH-trans: add kubeadm_alpha_phase_certs_renew_etcd-healthcheck-client.md (#12042)

* Create kubeadm_alpha_phase_certs_renew_etcd-healthcheck-client.md

* Update kubeadm_alpha_phase_certs_renew_etcd-healthcheck-client.md

* Update kubeadm_alpha_phase_certs_renew_etcd-healthcheck-client.md

* Update kubeadm_version.md (#12046)

* Update _index.md (#12063)

* zh-trans:/docs/reference/setup-tools/kubefed/kubefed_version.md (#12085)

zh-trans:/docs/reference/setup-tools/kubefed/kubefed_version.md

* ZH-trans: add kubeadm_alpha_phase_certs_etcd-peer.md (#12037)

* Create kubeadm_alpha_phase_certs_etcd-peer.md

* Update kubeadm_alpha_phase_certs_etcd-peer.md

* Update kubeadm_alpha_phase_certs_etcd-peer.md

* ZH-trans: add kubeadm_alpha_phase_kubelet_config_download.md (#12033)

* Create kubeadm_alpha_phase_kubelet_config_download.md

* Update kubeadm_alpha_phase_kubelet_config_download.md

* zh-trans: add docs/tasks/access-application-cluster/_index.md (#12048)

* zh-trans: update cpu-constraint-namespace.md and cpu-default-namespace.md (#12106)

* ZH-trans: update kubeadm_alpha_phase_upload-config.md (#12110)

* zh-tran: /docs/reference/setup-tools/kubefed/kubefed_unjoin.md (#12022)

* zh-tran: /docs/reference/setup-tools/kubefed/kubefed_unjoin.md

zh-tran: /docs/reference/setup-tools/kubefed/kubefed_unjoin.md

* Update kubefed_unjoin.md

* Update kubefed_unjoin.md

* Update kubefed_unjoin.md

* zh-trans:/docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_… (#12114)

* zh-trans:/docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_phase_certs_apiserver.md

zh-trans:/docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_phase_certs_apiserver.md

* Update kubeadm_alpha_phase_certs_apiserver.md

* Update kubeadm_alpha_phase_certs_apiserver.md

* zh-trans:/docs/reference/kubectl/docker-cli-to-kubectl.md (#12088)

* zh-trans:/docs/reference/kubectl/docker-cli-to-kubectl.md

zh-trans:/docs/reference/kubectl/docker-cli-to-kubectl.md

* Update docker-cli-to-kubectl.md

* zh-trans: /docs/reference/kubectl/conventions.md (#12089)

* zh-trans: /docs/reference/kubectl/conventions.md

zh-trans: /docs/reference/kubectl/conventions.md

* Update conventions.md

* zh-trans organize-cluster-access-kubeconfig.md (#12094)

* zh-trans:/docs/reference/setup-tools/kubefed/kubefed.md (#12086)

* zh-trans:/docs/reference/setup-tools/kubefed/kubefed.md

zh-trans:/docs/reference/setup-tools/kubefed/kubefed.md

* Update kubefed.md

* zh-trans:/docs/reference/setup-tools/kubefed/kubefed_join.md (#12029)

* zh-trans:/docs/reference/setup-tools/kubefed/kubefed_join.md

zh-trans:/docs/reference/setup-tools/kubefed/kubefed_join.md

* Update kubefed_join.md

* Update kubefed_join.md

* zh-trans: /docs/reference/setup-tools/kubefed/kubefed_init.md (#12020)

* zh-trans: /docs/reference/setup-tools/kubefed/kubefed_init.md

zh-trans: /docs/reference/setup-tools/kubefed/kubefed_init.md

* Update kubefed_init.md

* Update kubefed_init.md

* Update kubefed_init.md

* zh-trans: add docs/setup/independent/control-plane-flags.md (#12043)

* zh-trans: add docs/setup/independent/control-plane-flags.md

* update content/zh/docs/setup/independent/control-plane-flags.md

* zh-trans:/docs/tasks/tools/install-kubectl.md (#11992)

* configure-aggregation-layer.md

* configure-aggregation-layer.md

* configure-aggregation-layer.md

* configure-aggregation-layer.md

* Update configure-aggregation-layer.md

* .

* .

* .

* .

* .

* .

* .

* .

* configure-aggregation-layer.md

* .

* .

* Update configure-aggregation-layer.md

* .

* .

* .

* .

* zh-trans: add /docs/concepts/cluster-administration/manage-deployment.md (#11899)

* add /docs/concepts/cluster-administration/manage-deployment.md

* 更新部分翻译,去除多余的反引号

* 更新部分翻译

* zh-trans: add docs/tasks/service-catalog/install-service-catalog-using-sc.md (#12045)

* zh-trans: add docs/tasks/service-catalog/install-service-catalog-using-sc.md

* update docs/tasks/service-catalog/install-service-catalog-using-sc.md

* zh-trans:/docs/reference/setup-tools/kubefed/kubefed_options.md (#12087)

* zh-trans:/docs/reference/setup-tools/kubefed/kubefed_options.md

zh-trans:/docs/reference/setup-tools/kubefed/kubefed_options.md

* Update kubefed_options.md

* Update kubefed_options.md

* zh-trans: Fix some blog links issue (#12115)

* zh-trans: Fix some blog links issue

* Revert the space change

* update Set Kubelet parameters via a config file (#12150)

* zh-trans:/docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_phase_kubeconfig_all.md (#12185)

zh-trans:/docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_phase_kubeconfig_all.md

* zh-trans:/docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_… (#12184)

* zh-trans:/docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_phase_etcd_local.md

zh-trans:/docs/reference/setup-tools/kubeadm/generated/kubeadm_alpha_phase_etcd_local.md

* Update kubeadm_alpha_phase_etcd_local.md

* zh-trans: kubeadm/generated/kubeadm_alpha_phase_kubelet_config_upload.md (#12130)

zh-trans: kubeadm/generated/kubeadm_alpha_phase_kubelet_config_upload.md

* zh-trans: kubeadm/generated/kubeadm_alpha_phase_kubeconfig_admin.md (#12131)

zh-trans: kubeadm/generated/kubeadm_alpha_phase_kubeconfig_admin.md

* zh-trans: /docs/contribute/generate-ref-docs/kubernetes-api.md (#12141)

Signed-off-by: liyuan198251 <li.yuan4@zte.com.cn>

* zh-trans:/docs/concepts/overview/object-management-kubectl/imperative… (#12151)

* zh-trans:/docs/concepts/overview/object-management-kubectl/imperative-config.md

zh-trans:/docs/concepts/overview/object-management-kubectl/imperative-config.md

* Update imperative-config.md

* ZH-trans: added a blog post Chinese translation: 2018-05-01-developing-on-kubernetes.md (#12009)

* added a blog post chinese translation

* Update 2018-05-01-developing-on-kubernetes.md

apply some suggested changes per review comments

* Update 2018-05-01-developing-on-kubernetes.md

cont to review and improve the wording, up to squash

* more update and rewording

* ZH-trans: add kubeadm_alpha_phase_kubelet_config_enable-dynamic.md (#12209)

* ZH-trans: add kubeadm_alpha_phase_kubelet_config_enable-dynamic.md

* Update kubeadm_alpha_phase_kubelet_config_enable-dynamic.md

* ZH-trans: add kubeadm_alpha_phase_certs_renew_apiserver.md (#12210)

* ZH-trans: add kubeadm_alpha_phase_certs_renew_apiserver.md

* Update kubeadm_alpha_phase_certs_renew_apiserver.md

* Update kubeadm_alpha_phase_certs_renew_apiserver.md

* ZH-trans: add kubeadm_alpha_phase_certs_front-proxy-client.md (#12212)

* fix docs style (#12225)

* fix docs style

fix docs style

* fix docs style

fix docs style

* ZH-trans: add rbac.md (#12263)

* ZH-trans: add rbac.md

* Update rbac.md

* ZH-trans: add persistent-volume-claim.md (#12264)

* ZH-trans: add persistent-volume-claim.md

* Update persistent-volume-claim.md

* Update persistent-volume-claim.md

* Update docker-cli-to-kubectl.md (#12288)

* ZH-trans: add kubeadm_alpha_phase_selfhosting_convert-from-staticpods.md (#12285)

* ZH-trans: add kubeadm_alpha_phase_selfhosting_convert-from-staticpods.md

* Update kubeadm_alpha_phase_selfhosting_convert-from-staticpods.md

* ZH-trans: add coredns.md (#12282)

* ZH-trans: add coredns.md

* Update coredns.md

* ZH-trans: add kubeadm_alpha_phase_certs_etcd-healthcheck-client.md (#12286)

* ZH-trans: add kubeadm_alpha_phase_certs_etcd-healthcheck-client.md

* Update kubeadm_alpha_phase_certs_etcd-healthcheck-client.md

* ZH-trans: add kubeadm_alpha_phase_kubeconfig_kubelet.md (#12284)

* ZH-trans: add kubeadm_alpha_phase_kubeconfig_kubelet.md

* Update kubeadm_alpha_phase_kubeconfig_kubelet.md

* ZH-trans: add service-account.md (#12261)

* ZH-trans: add service-account.md

* Update service-account.md

* ZH-trans: add security-context.md (#12262)

* ZH-trans: add security-context.md

* Update security-context.md

* Update security-context.md

* Update security-context.md

* fix typo "_必须_" -> "必须" (#12300)

fix typo "_必须_" -> "必须"

* fix docs style error (#12307)

fix docs style error

* Create explore-interactive.html (#12311)

* fix docs style error (#12314)

fix docs style error

* ZH-trans: add kube-controller-manager.md (#12260)

* ZH-trans: add kube-controller-manager.md

* Update kube-controller-manager.md

* Update kube-controller-manager.md

* Update kube-controller-manager.md

* zh-trans: /docs/contribute/localization.md (#12295)

Signed-off-by: liyuan198251 <li.yuan4@zte.com.cn>

zh-trans: /docs/contribute/localization.md; update

Signed-off-by: liyuan198251 <li.yuan4@zte.com.cn>

zh-trans: /docs/contribute/localization.md; update2

Signed-off-by: liyuan198251 <li.yuan4@zte.com.cn>

* ZH-trans: update tools.md (#12320)

ZH-trans: update tools.md

* ZH-trans: fix "kubead -config" -> "kubeadm-config" (#12319)

* ZH-trans: update kubeadm_config.md

* fix style error

* correct "availability” trans for chinese (#12394)

* ZH-trans:/docs/tasks/debug-application-cluster/debug-service.md (#12275)

* configure-aggregation-layer.md

* configure-aggregation-layer.md

* configure-aggregation-layer.md

* configure-aggregation-layer.md

* Update configure-aggregation-layer.md

* .

* .

* .

* .

* .

* .

* .

* .

* configure-aggregation-layer.md

* .

* .

* Update configure-aggregation-layer.md

* .

* .

* .

* .

* .

* .

* .

* .

* Translate some remnant partials for localization (#12240)

* zh-trans: /docs/tasks/administer-cluster/limit-storage-consumption.md (#12415)

* zh-trans: /docs/tasks/administer-cluster/limit-storage-consumption.md

zh-trans: /docs/tasks/administer-cluster/limit-storage-consumption.md

* Update limit-storage-consumption.md

* Update limit-storage-consumption.md

* update link to SSH tunneling (#12615)

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

* zh-trans: update content/zh/docs/setup/certificates.md (#12620)

* ZH-trans: add kubeadm_alpha_phase_certs_apiserver-kubelet-client.md (#12619)

* ZH-trans: add kubeadm_alpha_phase_certs_apiserver-kubelet-client.md

* Update kubeadm_alpha_phase_certs_apiserver-kubelet-client.md

* zh-trans: node-conformance.md (#12356)

* zh-trans: node-conformance.md

zh-trans: node-conformance.md

* better translation

better translation

* zh-trans: translate docs/getting-started-guides/ubuntu/operational-co… (#12353)

* zh-trans: translate docs/getting-started-guides/ubuntu/operational-considerations.md

* Adopt PR suggestions

* add period sign

* zh-trans: krib.md (#12363)

* zh-trans: krib.md

zh-trans: krib.md

* Update krib.md

* Update krib.md

* Update krib.md

* Update krib.md

* zh-trans: /docs/tasks/administer-federation/events.md (#12411)

* zh-trans: /docs/tasks/administer-federation/events.md

zh-trans: /docs/tasks/administer-federation/events.md

* Update events.md

* Update events.md

* zh-trans: /docs/setup/turnkey/azure.md (#12412)

zh-trans: /docs/setup/turnkey/azure.md

* zh-trans:/docs/tasks/administer-federation/hpa.md & /docs/tasks/administer-cluster/extended-resource-node.md (#12432)

* configure-aggregation-layer.md

* configure-aggregation-layer.md

* configure-aggregation-layer.md

* configure-aggregation-layer.md

* Update configure-aggregation-layer.md

* .

* .

* .

* .

* .

* .

* .

* .

* configure-aggregation-layer.md

* .

* .

* Update configure-aggregation-layer.md

* .

* .

* .

* .

* .

* Add arm64, ppc64le and s390x platforms for calico (#12666)

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

add only

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

* zh-trans: developing-cloud-controller-manager.md (#12413)

* zh-trans: /docs/tasks/administer-cluster/developing-cloud-controller-manager.md

zh-trans: /docs/tasks/administer-cluster/developing-cloud-controller-manager.md

* Update developing-cloud-controller-manager.md

* fix typo: delete useless "**"

* Update developing-cloud-controller-manager.md

* ZH-trans: add 2018-05-01-developing-on-kubernetes.md (#12814)

* ZH-trans: update encrypt-data.md (#12939)

* ZH-trans: update encrypt-data.md

* Update encrypt-data.md

* ZH-trans: add example-task-template.md (#12940)

* ZH-trans: add example-task-template.md

* Update example-task-template.md

* Added Instana to tools (#12978)

Instana is already available in the english version of the text, therefore I added it here too. Hope my skills were enough to make the text still correct :-)

* ZH-trans: add expose-interactive.html (#12965)

* ZH-trans: add expose-interactive.html

* Update content/zh/docs/tutorials/kubernetes-basics/expose/expose-interactive.html

Co-Authored-By: xichengliudui <1693291525@qq.com>

* ZH-trans: add cloudstack.md (#12967)

* Create cloudstack.md

* Update cloudstack.md

* Update cloudstack.md

* Update cloudstack.md

* ZH-trans: add container-lifecycle-hooks.md (#12941)

* ZH-trans: add container-lifecycle-hooks.md

* Update container-lifecycle-hooks.md

* translate content/zh/docs/tasks/administer-cluster/dns-debugging-resolution.md to chinese (#12904)

* ZH-trans: add expose-external-ip-address.md (#12955)

* ZH-trans: add expose-external-ip-address.md

* Update expose-external-ip-address.md

* Update expose-external-ip-address.md

* Update expose-external-ip-address.md

* Update expose-external-ip-address.md

* Update expose-external-ip-address.md

* ZH-trans: add dns-horizontal-autoscaling.md (#12948)

* ZH-trans: add dns-horizontal-autoscaling.md

* Update dns-horizontal-autoscaling.md

* Update dns-horizontal-autoscaling.md

* zh-trans: update content/zh/docs/concepts/_index.md (#13182)

* zh-trans: update content/zh/docs/reference/access-authn-authz/node.md (#13181)

* Update dns-horizontal-autoscaling.md (#13119)

* Update dns-horizontal-autoscaling.md

* Update dns-horizontal-autoscaling.md

* Update dns-horizontal-autoscaling.md

* ZH-trans: add 2018-10-03-kubedirector.md (#13048)

* ZH-trans: add 2018-10-03-kubedirector.md

* Update 2018-10-03-kubedirector.md

* Update 2018-10-03-kubedirector.md

* ZH-trans: add guestbook.md (#12953)

* ZH-trans: add guestbook.md

* Update guestbook.md

* Update guestbook.md

* Update guestbook.md

* Update guestbook.md

* ZH-trans: add set-up-placement-policies-federation.md (#12947)

* ZH-trans: add set-up-placement-policies-federation.md

* update pull request

* Update set-up-placement-policies-federation.md

* Update set-up-placement-policies-federation.md

* Update set-up-placement-policies-federation.md

* Update set-up-placement-policies-federation.md

* ZH-trans: add service-accounts-admin.md (#13047)

* ZH-trans: add service-accounts-admin.md

* Update service-accounts-admin.md

* Update service-accounts-admin.md

* ZH-trans: add update-api-object-kubectl-patch.md (#12943)

* ZH-trans: add update-api-object-kubectl-patch.md

* Update update-api-object-kubectl-patch.md

* Update update-api-object-kubectl-patch.md

* Update update-api-object-kubectl-patch.md

* Update update-api-object-kubectl-patch.md

* ZH-trans: add parallel-processing-expansion.md (#12944)

* ZH-trans: add parallel-processing-expansion.md

* Update parallel-processing-expansion.md

* Update parallel-processing-expansion.md

* zh-trans: add 2018-12-05-new-contributor-shanghai.md (#12778)

* add zh 2017-03-00-Five-Days-Of-Kubernetes-1-6.md

add zh 2018-12-05-new-contributor-shanghai.md

* Delete 2017-03-00-Five-Days-Of-Kubernetes-1-6.md

* zh-trans: /docs/contribute/style/write-new-topic.md (#12572)

Signed-off-by: liyuan198251 <li.yuan4@zte.com.cn>

zh-trans: /docs/contribute/style/write-new-topic.md; update

Signed-off-by: liyuan198251 <li.yuan4@zte.com.cn>

* zh-trans: update content/zh/docs/setup/salt.md (#13202)

* zh-trans: add docs/reference/setup-tools/kubeadm/generated/kubeadm_token.md (#13198)

* ZH-trans: add kubeadm_upgrade_diff.md (#13170)

* ZH-trans: add kubeadm_upgrade_diff.md

* Update kubeadm_upgrade_diff.md

* Update kubeadm_upgrade_diff.md

* zh-trans: update docs/reference/access-authn-authz/authorization.md (#13180)

* zh-trans: update docs/reference/setup-tools/kubeadm/kubeadm-config.md (#13179)

* zh-trans: add docs/concepts/storage/dynamic-provisioning.md (#13171)

* ZH-trans: add 2015-05-00-Kubernetes-On-Openstack.md (#13149)

* ZH-trans: add Kubernetes开源项目产品经理

* Update 2015-05-00-Kubernetes-On-Openstack.md

* ZH-trans: add 2015-03-00-Welcome-To-Kubernetes-Blog.md (#13131)

* ZH-trans: add 2015-03-00-Welcome-To-Kubernetes-Blog.md

* Update 2015-03-00-Welcome-To-Kubernetes-Blog.md

* ZH-trans: add 2015-06-00-Slides-Cluster-Management-With.md (#13123)

* ZH-trans: add 2015-06-00-Slides-Cluster-Management-With.md

* Update 2015-06-00-Slides-Cluster-Management-With.md

* Create 2015-03-00-Kubernetes-Gathering-Videos.md (#13124)

* ZH-trans: add 2015-03-00-Weekly-Kubernetes-Community-Hangout.md (#13129)

* ZH-trans: add 2015-03-00-Weekly-Kubernetes-Community-Hangout.md

* Update 2015-03-00-Weekly-Kubernetes-Community-Hangout.md

* ZH-trans: add 2015-04-00-Kubernetes-Release-0150.md (#13130)

* ZH-trans: add 2015-04-00-Kubernetes-Release-0150.md

* Update 2015-04-00-Kubernetes-Release-0150.md

* ZH-trans: add 2015-04-00-Weekly-Kubernetes-Community-Hangout_17.md (#13132)

* ZH-trans: add 2015-04-00-Weekly-Kubernetes-Community-Hangout_17.md

* Update 2015-04-00-Weekly-Kubernetes-Community-Hangout_17.md

* Update 2015-04-00-Weekly-Kubernetes-Community-Hangout_17.md

* Update 2015-04-00-Weekly-Kubernetes-Community-Hangout_17.md

* ZH-trans: add 2015-04-00-Weekly-Kubernetes-Community-Hangout_29.md (#13147)

* ZH-trans: add 2015-05-00-Weekly-Kubernetes-Community-Hangout.md (#13148)

* ZH-trans: add flannel_multi_node_cluster.md (#13195)

* ZH-trans: add flannel_multi_node_cluster.md

* Update flannel_multi_node_cluster.md

* Update flannel_multi_node_cluster.md

* zh-trans: add docs/reference/command-line-tools-reference/kubelet-authentication-authorization.md (#13200)

* zh-trans: add docs/reference/command-line-tools-reference/kubelet-authentication-authorization.md

* Update kubelet-authentication-authorization.md

* zh-trans: /docs/tasks/administer-cluster/out-of-resource.md (#12879)

* configure-aggregation-layer.md

* configure-aggregation-layer.md

* configure-aggregation-layer.md

* configure-aggregation-layer.md

* Update configure-aggregation-layer.md

* .

* .

* .

* .

* .

* .

* .

* .

* configure-aggregation-layer.md

* .

* .

* Update configure-aggregation-layer.md

* .

* .

* .

* .

* .

* .

* zh-trans: update docs/setup/node-conformance.md (#13201)

* zh-trans: update docs/setup/node-conformance.md

* zh-trans: update docs/setup/on-premises-vm/dcos.md

* zh-trans: add content/zh/blog/_posts/2018-10-15-steering-election-results.md (#13227)

* zh-trans: add content/zh/blog/_posts/2018-10-15-steering-election-results.md

* Update content/zh/blog/_posts/2018-10-15-steering-election-results.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* Add @xichengliudui to sig-docs-zh-owners (release-1.12) (#13167)

* Add @xichengliudui to sig-docs-zh-owners

* Update OWNERS_ALIASES

* ZH-trans: add coreos.md (#13193)

* ZH-trans: coreos.md

* Update coreos.md

* Update coreos.md

* Update coreos.md

* Update coreos.md

* Update coreos.md

* Update coreos.md

* add SataQiu as a sig-docs-zh-owner (#13271)

* Fix relative links issue in zh content (#13312)

* `http://kubernetes.io/docs/` -> `/docs/`

* `https://kubernetes.io/docs/` -> `/docs/`

* zh-trans: add docs/reference/setup-tools/kubeadm/kubeadm-upgrade.md (#13194)

* zh-trans: add docs/reference/setup-tools/kubeadm/kubeadm-upgrade.md

* Update content/zh/docs/reference/setup-tools/kubeadm/kubeadm-upgrade.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* Update kubeadm-upgrade.md

* ZH-trans: add kubeadm-upgrade-ha-1-12.md (#13306)

* ZH-trans: add kubeadm-upgrade-ha-1-12.md

* Update kubeadm-upgrade-ha-1-12.md

* Update kubeadm-upgrade-ha-1-12.md

* Update kubeadm-upgrade-ha-1-12.md

* Update kubeadm-upgrade-ha-1-12.md

* Update kubeadm-upgrade-ha-1-12.md

* Update kubeadm-upgrade-ha-1-12.md

* Update config.toml (#13408)

* zh-trans: add content/zh/blog/_posts/2018-11-08-kubernetes-docs-update-i18n.md (#13221)

* zh-trans: add content/zh/docs/reference/kubernetes-api/labels-annotations-taints.md (#13236)

* zh-trans: add content/zh/blog/_posts/2018-10-16-kubernetes-2018-north-american-contributor-summit.md (#13274)

* zh-trans: add content/zh/docs/tasks/service-catalog/install-service-catalog-using-helm.md (#13268)

* zh-trans: add content/zh/docs/tasks/service-catalog/install-service-catalog-using-helm.md

* Update content/zh/docs/tasks/service-catalog/install-service-catalog-using-helm.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* Update content/zh/docs/tasks/service-catalog/install-service-catalog-using-helm.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* Update content/zh/docs/tasks/service-catalog/install-service-catalog-using-helm.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* zh-trans: update content/zh/docs/tasks/service-catalog/install-service-catalog-using-helm.md

* ZH-trans: add 2017-10-00-Five-Days-Of-Kubernetes-18.md (#13427)

* ZH-trans: add 2017-10-00-Five-Days-Of-Kubernetes-18.md

* Update 2017-10-00-Five-Days-Of-Kubernetes-18.md

* zh-trans: add content/zh/docs/tasks/administer-federation/daemonset.md (#13239)

* message

* more message

* remove data.json

* ZH-trans: add aws.md (#13276)

* ZH-trans: add aws.md

* Update aws.md

* Update aws.md

* ZH-trans: add cluster-interactive.html (#13479)

* ZH-trans: add cluster-interactive.html

* Update cluster-interactive.html

* ZH-trans: add update-intro.html (#13480)

* Create update-intro.html

* Update update-intro.html

* Update update-intro.html

* Update update-intro.html

* Update update-intro.html

* Update update-intro.html

* ZH-trans: add README.md (#13235)

* ZH-trans: add vendoring

* Update README.md

* zh: docs/cocepts/cluster-administration/logging.md (#13541)

* zh: docs/cocepts/cluster-administration/logging.md

* Update logging.md

* zh-trans: update docker-cli-to-kubectl.md (#13591)

* Update docker-cli-to-kubectl.md

* Update docker-cli-to-kubectl.md

* zh-trans: update advanced.md (#13592)

* ZH-trans: add 2017-11-00-Autoscaling-In-Kubernetes.md (#13424)

* ZH-trans: add 2017-11-00-Autoscaling-In-Kubernetes.md

* Update 2017-11-00-Autoscaling-In-Kubernetes.md

* ZH-trans: add fedora_manual_config.md (#13439)

* ZH-trans: add fedora_manual_config.md

* Update fedora_manual_config.md

* zh-trans: content/zh/docs/concepts/overview/working-with-objects/labe… (#12277)

* zh-trans: content/zh/docs/concepts/overview/working-with-objects/labels.md

* update trans

* update trans

*  zh: docs/contribute/start.md trans (#13632)

* zh:docs/contribute/start.md trans

* Update start.md

* Update start.md

* Update start.md

* Update start.md

* Update content/zh/docs/contribute/start.md

Co-Authored-By: zhangqx2010 <zhangqx2010@users.noreply.github.com>

* Update content/zh/docs/contribute/start.md

Co-Authored-By: zhangqx2010 <zhangqx2010@users.noreply.github.com>

* Update content/zh/docs/contribute/start.md

Co-Authored-By: zhangqx2010 <zhangqx2010@users.noreply.github.com>

* zh-trans: update docs/reference/setup-tools/kubefed (#13729)

* Update 2017-10-00-Five-Days-Of-Kubernetes-18.md (#13472)

* zh-trans: add configure-multiple-schedulers.md (#13492)

* zh-trans: add configure-multiple-schedulers.md

* Update content/zh/docs/tasks/administer-cluster/configure-multiple-schedulers.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* Update content/zh/docs/tasks/administer-cluster/configure-multiple-schedulers.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* Update configure-multiple-schedulers.md

* Update configure-multiple-schedulers.md

* Update content/zh/docs/tasks/administer-cluster/configure-multiple-schedulers.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* Update content/zh/docs/tasks/administer-cluster/configure-multiple-schedulers.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* Update content/zh/docs/tasks/administer-cluster/configure-multiple-schedulers.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* Update configure-multiple-schedulers.md

* zh-trans: add docs/tasks/configure-pod-container/share-process-namespace.md (#13551)

* zh-trans: add docs/tasks/configure-pod-container/share-process-namespace.md

* Update share-process-namespace.md

* zh-trans: update docs/admin/accessing-the-api.md (#13744)

* zh-trans: add content/zh/blog/_posts/2018-10-11-topology-aware-volume-provisioning.md (#13303)

* ZH-trans: add 2016-02-00-Kubecon-Eu-2016-Kubernetes-Community-In.md (#13241)

* ZH-trans: add 2016-02-00-Kubecon-Eu-2016-Kubernetes-Community-In.md

* Update 2016-02-00-Kubecon-Eu-2016-Kubernetes-Community-In.md

* Update 2016-02-00-Kubecon-Eu-2016-Kubernetes-Community-In.md

* ZH-trans: add  2016-07-00-Citrix-Netscaler-And-Kubernetes.md (#13242)

* ZH-trans: add  2016-07-00-Citrix-Netscaler-And-Kubernetes.md

* Update 2016-07-00-Citrix-Netscaler-And-Kubernetes.md

* Update 2016-07-00-Citrix-Netscaler-And-Kubernetes.md

* zh-trans: update docs/admin/bootstrap-tokens.md (#13770)

* zh-trans: update content/zh/docs/admin/cluster-large.md (#13771)

* zh-trans: update content/zh/docs/admin/kube-apiserver.md (#13774)

* zh-trans: update content/zh/docs/admin/kube-apiserver.md

* Update kube-apiserver.md

* Update content/zh/docs/admin/kube-apiserver.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* zh-trans: update content/zh/docs/admin/multiple-zones.md (#13775)

* zh-trans: update content/zh/docs/admin/multiple-zones.md

* Update multiple-zones.md

* zh-trans: update node-conformance.md and ovs-networking.md (#13776)

* zh-trans: update high-availability/_index.md and authorization/webhook.md (#13780)

* zh-trans: update content/zh/docs/admin/authorization/_index.md (#13779)

* zh-trans: update content/zh/docs/admin/authorization/_index.md

* Update _index.md

* Update content/zh/docs/admin/authorization/_index.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* Update content/zh/docs/admin/authorization/_index.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* Update content/zh/docs/admin/authorization/_index.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* zh-trans: update content/zh/docs/admin/authorization/abac.md (#13777)

* zh-trans: update content/zh/docs/admin/authorization/abac.md

* Update content/zh/docs/admin/authorization/abac.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* Update abac.md

* zh-trans: update content/zh/docs/admin/service-accounts-admin.md (#13778)

* zh-trans: update content/zh/docs/admin/service-accounts-admin.md

* Update content/zh/docs/admin/service-accounts-admin.md

Co-Authored-By: SataQiu <1527062125@qq.com>

* zh-trans: update content/zh/docs/concepts/architecture (#13797)

* ZH-trans: add cluster.md (#13500)

* ZH-trans: add cluster.md

* Update cluster.md

* Update cluster.md

* Update cluster.md

* zh-trans: update docs/concepts/cluster-administration (#13825)

* Exclude content-en changes in the PR

* Exclude content/ko changes in the PR

* Exclude OWNERS_ALIASES change in the PR

* rm kubeadm/generated/README.md to fix the build

* Remove generated sass assets
This commit is contained in:
chenrui
2019-06-17 12:28:11 -04:00
committed by Kubernetes Prow Robot
parent d437c2e5e5
commit 577b431931
717 changed files with 76342 additions and 1681 deletions
@@ -1,12 +1,10 @@
<!--
---
title: "配置 Pods 和容器"
weight: 20
---
<!--
title: "Configure Pods and Containers"
weight: 20
---
-->
---
title: "配置 Pod 和 容器"
weight: 20
---
@@ -0,0 +1,169 @@
---
title: 为容器生命周期事件添加处理程序
content_template: templates/task
weight: 140
---
<!--
{{% capture overview %}}
This page shows how to attach handlers to Container lifecycle events. Kubernetes supports
the postStart and preStop events. Kubernetes sends the postStart event immediately
after a Container is started, and it sends the preStop event immediately before the
Container is terminated.
{{% /capture %}}
-->
{{% capture overview %}}
本页面展示了如何将容器生命周期事件绑定到处理程序上。Kubernetes 支持 postStart 和 preStop 事件。Kubernetes 在启动容器之后会立即发送 postStart 事件
,在容器终止之前会立即发送 preStop 事件。
{{% /capture %}}
{{% capture prerequisites %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
{{% /capture %}}
{{% capture steps %}}
<!--
## Define postStart and preStop handlers
In this exercise, you create a Pod that has one Container. The Container has handlers
for the postStart and preStop events.
Here is the configuration file for the Pod:
-->
## 定义 postStart 和 preStop 处理程序
在本练习中,您将创建一个具有一个容器的 Pod。该容器包含用于处理 postStart 和 preStop 事件的程序。
这是 Pod 的配置文件:
{{< codenew file="pods/lifecycle-events.yaml" >}}
<!--
In the configuration file, you can see that the postStart command writes a `message`
file to the Container's `/usr/share` directory. The preStop command shuts down
nginx gracefully. This is helpful if the Container is being terminated because of a failure.
-->
在配置文件中,您可以看到 postStart 命令写入 `message` 文件到容器的的 `/usr/share` 目录。preStop 命令优雅地关闭了 nginx 。如果容器因故障而终止,这就会非常有用。
<!--
Create the Pod:
kubectl create -f https://k8s.io/examples/pods/lifecycle-events.yaml
-->
创建 Pod:
kubectl create -f https://k8s.io/examples/pods/lifecycle-events.yaml
<!--
Verify that the Container in the Pod is running:
kubectl get pod lifecycle-demo
-->
验证 Pod 里的容器处于运行状态:
kubectl get pod lifecycle-demo
<!--
Get a shell into the Container running in your Pod:
kubectl exec -it lifecycle-demo -- /bin/bash
-->
获取一个访问 Pod 中运行容器的 shell:
kubectl exec -it lifecycle-demo -- /bin/bash
<!--
In your shell, verify that the `postStart` handler created the `message` file:
root@lifecycle-demo:/# cat /usr/share/message
-->
在 shell 中,验证 `postStart` 处理程序是否创建了 `message` 文件:
root@lifecycle-demo:/# cat /usr/share/message
<!---
The output shows the text written by the postStart handler:
Hello from the postStart handler
-->
输出显示 postStart 处理程序写入的文本:
Hello from the postStart handler
{{% /capture %}}
{{% capture discussion %}}
<!--
## Discussion
Kubernetes sends the postStart event immediately after the Container is created.
There is no guarantee, however, that the postStart handler is called before
the Container's entrypoint is called. The postStart handler runs asynchronously
relative to the Container's code, but Kubernetes' management of the container
blocks until the postStart handler completes. The Container's status is not
set to RUNNING until the postStart handler completes.
-->
## 讨论
Kubernetes 在创建容器后立即发送 postStart 事件。但是,不能保证 postStart 处理程序
在容器的 entrypoint 调用之前被调用。相对于容器的代码,postStart 处理程序以异步方式运行,但 Kubernetes 对容器的管理
会阻塞直到 postStart 处理程序完成。容器的状态直到 postStart 处理程序完成后才会设置为 RUNNING 。
<!--
Kubernetes sends the preStop event immediately before the Container is terminated.
Kubernetes' management of the Container blocks until the preStop handler completes,
unless the Pod's grace period expires. For more details, see
[Termination of Pods](/docs/user-guide/pods/#termination-of-pods).
-->
Kubernetes 在容器终止之前立即发送 preStop 事件。
Kubernetes 对容器的管理一直阻塞直到 preStop 处理程序完成, 除非 Pod 的宽限期过期。有关详细信息,请参阅
[Pods 的终止](/docs/user-guide/pods/#termination-of-pods) 。
{{< note >}}
<!--
Kubernetes only sends the preStop event when a Pod is *terminated*.
This means that the preStop hook is not invoked when the Pod is *completed*.
This limitation is tracked in [issue #55087](https://github.com/kubernetes/kubernetes/issues/55807).
-->
Kubernetes 仅在 Pod 是 *terminated* 时发送 preStop 事件。这意味着当 Pod 是 *completed* 状态时,preStop 钩子程序不会被触发。
这个限制被记录在 [issue #55087](https://github.com/kubernetes/kubernetes/issues/55807) 中。
{{< /note >}}
{{% /capture %}}
{{% capture whatsnext %}}
<!--
* Learn more about [Container lifecycle hooks](/docs/concepts/containers/container-lifecycle-hooks/).
* Learn more about the [lifecycle of a Pod](/docs/concepts/workloads/pods/pod-lifecycle/).
-->
* 进一步了解 [容器生命周期钩子](/docs/concepts/containers/container-lifecycle-hooks/).
* 进一步了解 [Pod 的生命周期](/docs/concepts/workloads/pods/pod-lifecycle/).
<!--
### Reference
* [Lifecycle](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#lifecycle-v1-core)
* [Container](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#container-v1-core)
* See `terminationGracePeriodSeconds` in [PodSpec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podspec-v1-core)
-->
### 参考
* [Lifecycle](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#lifecycle-v1-core)
* [Container](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#container-v1-core)
* 查看 [PodSpec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podspec-v1-core) 文档中关于 `terminationGracePeriodSeconds` 的说明
{{% /capture %}}
@@ -0,0 +1,375 @@
---
title: 配置 Pod 以使用 PersistentVolume 作为存储
content_template: templates/task
weight: 60
---
<!--
---
title: Configure a Pod to Use a PersistentVolume for Storage
content_template: templates/task
weight: 60
---
-->
{{% capture overview %}}
<!--
This page shows how to configure a Pod to use a PersistentVolumeClaim for storage.
Here is a summary of the process:
1. A cluster administrator creates a PersistentVolume that is backed by physical
storage. The administrator does not associate the volume with any Pod.
1. A cluster user creates a PersistentVolumeClaim, which gets automatically
bound to a suitable PersistentVolume.
1. The user creates a Pod that uses the PersistentVolumeClaim as storage.
-->
本文介绍如何配置 Pod 使用 PersistentVolumeClaim 作为存储。
以下是该过程的总结:
1. 集群管理员创建由物理存储支持的 PersistentVolume。管理员不将卷与任何 Pod 关联。
1. 群集用户创建一个 PersistentVolumeClaim,它将自动绑定到合适的 PersistentVolume。
1. 用户创建一个使用 PersistentVolumeClaim 作为存储的 Pod。
{{% /capture %}}
{{% capture prerequisites %}}
<!--
* You need to have a Kubernetes cluster that has only one Node, and the kubectl
command-line tool must be configured to communicate with your cluster. If you
do not already have a single-node cluster, you can create one by using
[Minikube](/docs/getting-started-guides/minikube).
* Familiarize yourself with the material in
[Persistent Volumes](/docs/concepts/storage/persistent-volumes/).
-->
* 您需要一个包含单个节点的 Kubernetes 集群,并且必须配置 kubectl 命令行工具以便与集群交互。
如果还没有单节点集群,可以使用 [Minikube](/docs/getting-started-guides/minikube) 创建一个。
* 熟悉[持久卷](/docs/concepts/storage/persistent-volumes/)中的材料。
{{% /capture %}}
{{% capture steps %}}
<!--
## Create an index.html file on your Node
Open a shell to the Node in your cluster. How you open a shell depends on how
you set up your cluster. For example, if you are using Minikube, you can open a
shell to your Node by entering `minikube ssh`.
In your shell, create a `/mnt/data` directory:
-->
## 在你的节点上创建一个 index.html 文件
打开集群中节点的一个 shell。
如何打开 shell 取决于集群的设置。
例如,如果您正在使用 Minikube,那么可以通过输入 `minikube ssh` 来打开节点的 shell。
在 shell 中,创建一个 `/mnt/data` 目录:
mkdir /mnt/data
<!--
In the `/mnt/data` directory, create an `index.html` file:
-->
`/mnt/data` 目录中创建一个 index.html 文件:
echo 'Hello from Kubernetes storage' > /mnt/data/index.html
<!--
## Create a PersistentVolume
In this exercise, you create a *hostPath* PersistentVolume. Kubernetes supports
hostPath for development and testing on a single-node cluster. A hostPath
PersistentVolume uses a file or directory on the Node to emulate network-attached storage.
-->
## 创建 PersistentVolume
在本练习中,您将创建一个 *hostPath* 类型的 PersistentVolume。
Kubernetes 支持用于在单节点集群上开发和测试的 hostPath 类型的 PersistentVolume。
hostPath 类型的 PersistentVolume 使用节点上的文件或目录来模拟附带网络的存储。
<!--
In a production cluster, you would not use hostPath. Instead a cluster administrator
would provision a network resource like a Google Compute Engine persistent disk,
an NFS share, or an Amazon Elastic Block Store volume. Cluster administrators can also
use [StorageClasses](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#storageclass-v1-storage)
to set up
[dynamic provisioning](https://kubernetes.io/blog/2016/10/dynamic-provisioning-and-storage-in-kubernetes).
Here is the configuration file for the hostPath PersistentVolume:
-->
在生产集群中,您不会使用 hostPath。集群管理员会提供网络存储资源,比如 Google Compute Engine 持久盘卷、NFS 共享卷或 Amazon Elastic Block Store 卷。
集群管理员还可以使用 [StorageClasses](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#storageclass-v1-storage) 来设置[动态提供存储](https://kubernetes.io/blog/2016/10/dynamic-provisioning-and-storage-in-kubernetes)。
下面是 hostPath PersistentVolume 的配置文件:
{{< codenew file="pods/storage/pv-volume.yaml" >}}
<!--
The configuration file specifies that the volume is at `/mnt/data` on the
cluster's Node. The configuration also specifies a size of 10 gibibytes and
an access mode of `ReadWriteOnce`, which means the volume can be mounted as
read-write by a single Node. It defines the [StorageClass name](/docs/concepts/storage/persistent-volumes/#class)
`manual` for the PersistentVolume, which will be used to bind
PersistentVolumeClaim requests to this PersistentVolume.
Create the PersistentVolume:
-->
配置文件指定了该卷位于集群节点上的 `/mnt/data` 目录。
该配置还指定了 10 吉比特的卷大小和 `ReadWriteOnce` 的访问模式,这意味着该卷可以在单个节点上以读写方式挂载。
它为 PersistentVolume 定义了 [StorageClass 名称](/docs/concepts/storage/persistent-volumes/#class) 为 `manual`StorageClass 名称用来将 PersistentVolumeClaim 请求绑定到该 PersistentVolum。
创建 PersistentVolume
kubectl create -f https://k8s.io/examples/pods/storage/pv-volume.yaml
<!--
View information about the PersistentVolume:
-->
查看 PersistentVolume 的信息:
kubectl get pv task-pv-volume
<!--
The output shows that the PersistentVolume has a `STATUS` of `Available`. This
means it has not yet been bound to a PersistentVolumeClaim.
-->
输出结果显示该 PersistentVolume 的`状态(STATUS``Available`
这意味着它还没有被绑定给 PersistentVolumeClaim。
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE
task-pv-volume 10Gi RWO Retain Available manual 4s
<!--
## Create a PersistentVolumeClaim
The next step is to create a PersistentVolumeClaim. Pods use PersistentVolumeClaims
to request physical storage. In this exercise, you create a PersistentVolumeClaim
that requests a volume of at least three gibibytes that can provide read-write
access for at least one Node.
Here is the configuration file for the PersistentVolumeClaim:
-->
## 创建 PersistentVolumeClaim
下一步是创建一个 PersistentVolumeClaim。
Pod 使用 PersistentVolumeClaim 来请求物理存储。
在本练习中,您将创建一个 PersistentVolumeClaim,它请求至少 3 吉比特容量的卷,该卷至少可以为一个节点提供读写访问。
下面是 PersistentVolumeClaim 的配置文件:
{{< codenew file="pods/storage/pv-claim.yaml" >}}
<!--
Create the PersistentVolumeClaim:
-->
创建 PersistentVolumeClaim
kubectl create -f https://k8s.io/examples/pods/storage/pv-claim.yaml
<!--
After you create the PersistentVolumeClaim, the Kubernetes control plane looks
for a PersistentVolume that satisfies the claim's requirements. If the control
plane finds a suitable PersistentVolume with the same StorageClass, it binds the
claim to the volume.
Look again at the PersistentVolume:
-->
创建 PersistentVolumeClaim 之后,Kubernetes 控制平面将查找满足申领要求的 PersistentVolume。
如果控制平面找到具有相同 StorageClass 的适当的 PersistentVolume,则将 PersistentVolumeClaim 绑定到该 PersistentVolume 上。
再次查看 PersistentVolume 信息:
kubectl get pv task-pv-volume
<!--
Now the output shows a `STATUS` of `Bound`.
-->
现在输出的 `STATUS``Bound`
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE
task-pv-volume 10Gi RWO Retain Bound default/task-pv-claim manual 2m
<!--
Look at the PersistentVolumeClaim:
-->
查看 PersistentVolumeClaim
kubectl get pvc task-pv-claim
<!--
The output shows that the PersistentVolumeClaim is bound to your PersistentVolume,
`task-pv-volume`.
-->
输出结果表明该 PersistentVolumeClaim 绑定了你的 PersistentVolume `task-pv-volume`
NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
task-pv-claim Bound task-pv-volume 10Gi RWO manual 30s
<!--
## Create a Pod
The next step is to create a Pod that uses your PersistentVolumeClaim as a volume.
Here is the configuration file for the Pod:
-->
## 创建 Pod
下一步是创建一个 Pod, 该 Pod 使用你的 PersistentVolumeClaim 作为存储卷。
下面是 Pod 的 配置文件:
{{< codenew file="pods/storage/pv-pod.yaml" >}}
<!--
Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but
it does not specify a PersistentVolume. From the Pod's point of view, the claim
is a volume.
Create the Pod:
-->
注意 Pod 的配置文件指定了 PersistentVolumeClaim,但没有指定 PersistentVolume。对 Pod 而言,PersistentVolumeClaim 就是一个存储卷。
创建 Pod
kubectl create -f https://k8s.io/examples/pods/storage/pv-pod.yaml
<!--
Verify that the Container in the Pod is running;
-->
检查 Pod 中的容器是否运行正常:
kubectl get pod task-pv-pod
<!--
Get a shell to the Container running in your Pod:
-->
打开一个 shell 访问 Pod 中的容器:
kubectl exec -it task-pv-pod -- /bin/bash
<!--
In your shell, verify that nginx is serving the `index.html` file from the
hostPath volume:
-->
在 shell 中,验证 nginx 是否正在从 hostPath 卷提供 `index.html` 文件:
root@task-pv-pod:/# apt-get update
root@task-pv-pod:/# apt-get install curl
root@task-pv-pod:/# curl localhost
<!--
The output shows the text that you wrote to the `index.html` file on the
hostPath volume:
-->
输出结果是你之前写到 hostPath 卷中的 `index.html` 文件中的内容:
Hello from Kubernetes storage
{{% /capture %}}
{{% capture discussion %}}
<!--
## Access control
Storage configured with a group ID (GID) allows writing only by Pods using the same
GID. Mismatched or missing GIDs cause permission denied errors. To reduce the
need for coordination with users, an administrator can annotate a PersistentVolume
with a GID. Then the GID is automatically added to any Pod that uses the
PersistentVolume.
Use the `pv.beta.kubernetes.io/gid` annotation as follows:
-->
## 访问控制
使用 group ID(GID)配置的存储仅允许 Pod 使用相同的 GID 进行写入。
GID 不匹配或缺少将会导致许可被拒绝的错误。
为了减少与用户的协调,管理员可以使用 GID 对 PersistentVolume 进行注解。
这样 GID 就能自动的添加到使用 PersistentVolume 的任何 Pod 中。
使用 `pv.beta.kubernetes.io/gid` 注解的方法如下所示:
```yaml
kind: PersistentVolume
apiVersion: v1
metadata:
name: pv1
annotations:
pv.beta.kubernetes.io/gid: "1234"
```
<!--
When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID
is applied to all Containers in the Pod in the same way that GIDs specified in the
Pods security context are. Every GID, whether it originates from a PersistentVolume
annotation or the Pods specification, is applied to the first process run in
each Container.
-->
当 Pod 使用带有 GID 注解的 PersistentVolume 时,注解的 GID 会被应用于 Pod 中的所有容器,应用的方法与 Pod 的安全上下文中指定的 GID 相同。
每个 GID,无论是来自 PersistentVolume 注解还是来自 Pod 的规范,都应用于每个容器中运行的第一个进程。
{{< note >}}
<!--
When a Pod consumes a PersistentVolume, the GIDs associated with the
PersistentVolume are not present on the Pod resource itself.
-->
当 Pod 使用 PersistentVolume 时,与 PersistentVolume 关联的 GID 不会在 Pod 本身的资源对象上出现。
{{< /note >}}
{{% /capture %}}
{{% capture whatsnext %}}
<!--
* Learn more about [PersistentVolumes](/docs/concepts/storage/persistent-volumes/).
* Read the [Persistent Storage design document](https://git.k8s.io/community/contributors/design-proposals/storage/persistent-storage.md).
-->
* 进一步了解 [PersistentVolumes](/docs/concepts/storage/persistent-volumes/)。
* 阅读[持久存储设计文档](https://git.k8s.io/community/contributors/design-proposals/storage/persistent-storage.md)。
<!--
### Reference
-->
### 参考
* [PersistentVolume](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#persistentvolume-v1-core)
* [PersistentVolumeSpec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#persistentvolumespec-v1-core)
* [PersistentVolumeClaim](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#persistentvolumeclaim-v1-core)
* [PersistentVolumeClaimSpec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#persistentvolumeclaimspec-v1-core)
{{% /capture %}}
@@ -0,0 +1,151 @@
---
title: 配置 Pod 初始化
content_template: templates/task
weight: 130
---
<!--
---
title: Configure Pod Initialization
content_template: templates/task
weight: 130
---
-->
{{% capture overview %}}
<!--
This page shows how to use an Init Container to initialize a Pod before an
application Container runs.
-->
本文介绍在应用容器运行前,怎样利用 Init 容器初始化 Pod。
{{% /capture %}}
{{% capture prerequisites %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
{{% /capture %}}
{{% capture steps %}}
<!--
## Create a Pod that has an Init Container
In this exercise you create a Pod that has one application Container and one
Init Container. The init container runs to completion before the application
container starts.
Here is the configuration file for the Pod:
-->
## 创建一个包含 Init 容器的 Pod
本例中您将创建一个包含一个应用容器和一个 Init 容器的 Pod。Init 容器在应用容器启动前运行完成。
下面是 Pod 的配置文件:
{{< codenew file="pods/init-containers.yaml" >}}
<!--
In the configuration file, you can see that the Pod has a Volume that the init
container and the application container share.
The init container mounts the
shared Volume at `/work-dir`, and the application container mounts the shared
Volume at `/usr/share/nginx/html`. The init container runs the following command
and then terminates:
-->
配置文件中,您可以看到应用容器和 Init 容器共享了一个卷。
Init 容器将共享卷挂载到了 `/work-dir` 目录,应用容器将共享卷挂载到了 `/usr/share/nginx/html` 目录。
Init 容器执行完下面的命令就终止:
wget -O /work-dir/index.html http://kubernetes.io
<!--
Notice that the init container writes the `index.html` file in the root directory
of the nginx server.
Create the Pod:
-->
请注意 Init 容器在 nginx 服务器的根目录写入 `index.html`
创建 Pod
kubectl create -f https://k8s.io/examples/pods/init-containers.yaml
<!--
Verify that the nginx container is running:
-->
检查 nginx 容器运行正常:
kubectl get pod init-demo
<!--
The output shows that the nginx container is running:
-->
结果表明 nginx 容器运行正常:
NAME READY STATUS RESTARTS AGE
init-demo 1/1 Running 0 1m
<!--
Get a shell into the nginx container running in the init-demo Pod:
-->
通过 shell 进入 init-demo Pod 中的 nginx 容器:
kubectl exec -it init-demo -- /bin/bash
<!--
In your shell, send a GET request to the nginx server:
-->
在 shell 中,发送个 GET 请求到 nginx 服务器:
root@nginx:~# apt-get update
root@nginx:~# apt-get install curl
root@nginx:~# curl localhost
<!--
The output shows that nginx is serving the web page that was written by the init container:
-->
结果表明 nginx 正在为 Init 容器编写的 web 页面服务:
<!Doctype html>
<html id="home">
<head>
...
"url": "http://kubernetes.io/"}</script>
</head>
<body>
...
<p>Kubernetes is open source giving you the freedom to take advantage ...</p>
...
{{% /capture %}}
{{% capture whatsnext %}}
<!--
* Learn more about
[communicating between Containers running in the same Pod](/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/).
* Learn more about [Init Containers](/docs/concepts/workloads/pods/init-containers/).
* Learn more about [Volumes](/docs/concepts/storage/volumes/).
* Learn more about [Debugging Init Containers](/docs/tasks/debug-application-cluster/debug-init-containers/)
-->
* 进一步了解 [相同 Pod 中的容器间的通信](/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/)。
* 进一步了解 [Init 容器](/docs/concepts/workloads/pods/init-containers/)。
* 进一步了解 [](/docs/concepts/storage/volumes/)。
* 进一步了解 [Init 容器排错](/docs/tasks/debug-application-cluster/debug-init-containers/)。
{{% /capture %}}
@@ -0,0 +1,110 @@
---
reviewers:
- jpeeler
- pmorie
title: 配置 Pod 使用投射卷作存储
content_template: templates/task
weight: 70
---
<!--
---
reviewers:
- jpeeler
- pmorie
title: Configure a Pod to Use a Projected Volume for Storage
content_template: templates/task
weight: 70
---
-->
{{% capture overview %}}
<!--
This page shows how to use a [`projected`](/docs/concepts/storage/volumes/#projected) volume to mount
several existing volume sources into the same directory. Currently, `secret`, `configMap`, `downwardAPI`,
and `serviceAccountToken` volumes can be projected.
-->
本文介绍怎样通过[`投射`](/docs/concepts/storage/volumes/#projected) 卷将现有的多个卷资源挂载到相同的目录。
当前,`secret``configMap``downwardAPI``serviceAccountToken` 卷可以被投射。
{{< note >}}
<!--
`serviceAccountToken` is not a volume type.
-->
`serviceAccountToken` 不是一种卷类型
{{< /note >}}
{{% /capture %}}
{{% capture prerequisites %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
{{% /capture %}}
{{% capture steps %}}
<!--
## Configure a projected volume for a pod
In this exercise, you create username and password Secrets from local files. You then create a Pod that runs one Container, using a [`projected`](/docs/concepts/storage/volumes/#projected) Volume to mount the Secrets into the same shared directory.
Here is the configuration file for the Pod:
-->
## 为 Pod 配置投射卷
本练习中,您将从本地文件来创建包含有用户名和密码的 Secret。然后创建运行一个容器的 Pod,该 Pod 使用[`投射`](/docs/concepts/storage/volumes/#projected) 卷将 Secret 挂载到相同的路径下。
下面是 Pod 的配置文件:
{{< codenew file="pods/storage/projected.yaml" >}}
1. <!--Create the Secrets:-->创建 Secrets:
```shell
<!--# Create files containing the username and password:--># 创建包含用户名和密码的文件:
echo -n "admin" > ./username.txt
echo -n "1f2d1e2e67df" > ./password.txt-->
<!--# Package these files into secrets:--># 将上述文件引用到 Secret
kubectl create secret generic user --from-file=./username.txt
kubectl create secret generic pass --from-file=./password.txt
```
1. <!--Create the Pod:-->创建 Pod
```shell
kubectl create -f https://k8s.io/examples/pods/storage/projected.yaml
```
<!--Verify that the Pod's Container is running, and then watch for changes to
the Pod:-->确认 Pod 中的容器运行正常,然后监视 Pod 的变化:
```shell
kubectl get --watch pod test-projected-volume
```
<!--The output looks like this:-->输出结果和下面类似:
NAME READY STATUS RESTARTS AGE
test-projected-volume 1/1 Running 0 14s
1. <!--In another terminal, get a shell to the running Container:-->在另外一个终端中,打开容器的 shell:
```shell
kubectl exec -it test-projected-volume -- /bin/sh
```
1. <!--In your shell, verify that the `projected-volume` directory contains your projected sources:-->在 shell 中,确认 `projected-volume` 目录包含你的投射源:
```shell
ls /projected-volume/
```
{{% /capture %}}
{{% capture whatsnext %}}
<!--
* Learn more about [`projected`](/docs/concepts/storage/volumes/#projected) volumes.
* Read the [all-in-one volume](https://github.com/kubernetes/community/blob/{{< param "githubbranch" >}}/contributors/design-proposals/node/all-in-one-volume.md) design document.
-->
* 进一步了解[`投射`](/docs/concepts/storage/volumes/#projected) 卷。
* 阅读[一体卷](https://github.com/kubernetes/community/blob/{{< param "githubbranch" >}}/contributors/design-proposals/node/all-in-one-volume.md)设计文档。
{{% /capture %}}
@@ -0,0 +1,454 @@
---
reviewers:
- bprashanth
- liggitt
- thockin
title: 为 Pod 配置服务账户
content_template: templates/task
weight: 90
---
<!--
---
reviewers:
- bprashanth
- liggitt
- thockin
title: Configure Service Accounts for Pods
content_template: templates/task
weight: 90
---
-->
{{% capture overview %}}
<!--
A service account provides an identity for processes that run in a Pod.
*This is a user introduction to Service Accounts. See also the
[Cluster Admin Guide to Service Accounts](/docs/reference/access-authn-authz/service-accounts-admin/).*
-->
服务账户为 Pod 中运行的进程提供了一个标识。
*本文是服务账户的用户使用介绍。您也可以参考[集群管理指南之服务账户](/docs/reference/access-authn-authz/service-accounts-admin/)。*
{{< note >}}
<!--
This document describes how service accounts behave in a cluster set up
as recommended by the Kubernetes project. Your cluster administrator may have
customized the behavior in your cluster, in which case this documentation may
not apply.
-->
本文档描述 Kubernetes 项目推荐的集群中服务帐户的行为。
集群管理员也可能已经定制了服务账户在集群中的属性,在这种情况下,本文档可能并不适用。
{{< /note >}}
<!--
When you (a human) access the cluster (for example, using `kubectl`), you are
authenticated by the apiserver as a particular User Account (currently this is
usually `admin`, unless your cluster administrator has customized your
cluster). Processes in containers inside pods can also contact the apiserver.
When they do, they are authenticated as a particular Service Account (for example,
`default`).
-->
当您(人类)访问集群时(例如,使用 `kubectl`),api 服务器将您的身份验证为特定的用户帐户(当前这通常是 `admin`,除非您的集群管理员已经定制了您的集群配置)。
Pod 内的容器中的进程也可以与 api 服务器接触。
当它们进行身份验证时,它们被验证为特定的服务帐户(例如,`default`)。
{{% /capture %}}
{{% capture prerequisites %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
{{% /capture %}}
{{% capture steps %}}
<!--
## Use the Default Service Account to access the API server.
When you create a pod, if you do not specify a service account, it is
automatically assigned the `default` service account in the same namespace.
If you get the raw json or yaml for a pod you have created (for example, `kubectl get pods/podname -o yaml`),
you can see the `spec.serviceAccountName` field has been
[automatically set](/docs/user-guide/working-with-resources/#resources-are-automatically-modified).
-->
## 使用默认的服务账户访问 API 服务器
当您创建 Pod 时,如果没有指定服务账户,Pod 会被指定命名空间中的`default`服务账户。
如果您查看 Pod 的原始 json 或 yaml(例如:`kubectl get pods/podname -o yaml`),
您可以看到 `spec.serviceAccountName` 字段已经被[自动设置](/docs/user-guide/working-with-resources/#resources-are-automatically-modified)了。
<!--
You can access the API from inside a pod using automatically mounted service account credentials,
as described in [Accessing the Cluster](/docs/user-guide/accessing-the-cluster/#accessing-the-api-from-a-pod).
The API permissions of the service account depend on the [authorization plugin and policy](/docs/reference/access-authn-authz/authorization/#authorization-modules) in use.
In version 1.6+, you can opt out of automounting API credentials for a service account by setting
`automountServiceAccountToken: false` on the service account:
-->
您可以使用自动挂载给 Pod 的服务账户凭据访问 API,[访问集群](/docs/user-guide/accessing-the-cluster/#accessing-the-api-from-a-pod) 中有相关描述。
服务账户的 API 许可取决于您所使用的[授权插件和策略](/docs/reference/access-authn-authz/authorization/#authorization-modules)。
在 1.6 以上版本中,您可以通过在服务账户上设置 `automountServiceAccountToken: false` 来实现不给服务账号自动挂载 API 凭据:
```yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: build-robot
automountServiceAccountToken: false
...
```
<!--
In version 1.6+, you can also opt out of automounting API credentials for a particular pod:
-->
在 1.6 以上版本中,您也可以选择不给特定 Pod 自动挂载 API 凭据:
```yaml
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
serviceAccountName: build-robot
automountServiceAccountToken: false
...
```
<!--
The pod spec takes precedence over the service account if both specify a `automountServiceAccountToken` value.
## Use Multiple Service Accounts.
Every namespace has a default service account resource called `default`.
You can list this and any other serviceAccount resources in the namespace with this command:
-->
如果 Pod 和服务账户都指定了 `automountServiceAccountToken` 值,则 Pod 的 spec 优先于服务帐户。
## 使用多个服务账户
每个命名空间都有一个名为 `default` 的服务账户资源。
您可以用下面的命令查询这个服务账户以及命名空间中的其他 serviceAccount 资源:
```shell
kubectl get serviceAccounts
NAME SECRETS AGE
default 1 1d
```
<!--
You can create additional ServiceAccount objects like this:
-->
您可以像这样来创建额外的 ServiceAccount 对象:
```shell
kubectl create -f - <<EOF
apiVersion: v1
kind: ServiceAccount
metadata:
name: build-robot
EOF
serviceaccount/build-robot created
```
<!--
If you get a complete dump of the service account object, like this:
-->
如果您查询服务帐户对象的完整信息,如下所示:
```shell
kubectl get serviceaccounts/build-robot -o yaml
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: 2015-06-16T00:12:59Z
name: build-robot
namespace: default
resourceVersion: "272500"
selfLink: /api/v1/namespaces/default/serviceaccounts/build-robot
uid: 721ab723-13bc-11e5-aec2-42010af0021e
secrets:
- name: build-robot-token-bvbk5
```
<!--
then you will see that a token has automatically been created and is referenced by the service account.
You may use authorization plugins to [set permissions on service accounts](/docs/reference/access-authn-authz/rbac/#service-account-permissions).
To use a non-default service account, simply set the `spec.serviceAccountName`
field of a pod to the name of the service account you wish to use.
-->
那么您就能看到系统已经自动创建了一个令牌并且被服务账户所引用。
您可以使用授权插件来 [设置服务账户的访问许可](/docs/reference/access-authn-authz/rbac/#service-account-permissions)。
要使用非默认的服务账户,只需简单的将 Pod 的 `spec.serviceAccountName` 字段设置为您想用的服务账户名称。
<!--
The service account has to exist at the time the pod is created, or it will be rejected.
You cannot update the service account of an already created pod.
You can clean up the service account from this example like this:
-->
Pod 被创建时服务账户必须存在,否则会被拒绝。
您不能更新已经创建好的 Pod 的服务账户。
您可以清除服务账户,如下所示:
```shell
kubectl delete serviceaccount/build-robot
```
<!--
## Manually create a service account API token.
Suppose we have an existing service account named "build-robot" as mentioned above, and we create
a new secret manually.
-->
## 手动创建服务账户 API 令牌
假设我们有一个上面提到的名为 "build-robot" 的服务账户,然后我们手动创建一个新的 Secret。
```shell
kubectl create -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
name: build-robot-secret
annotations:
kubernetes.io/service-account.name: build-robot
type: kubernetes.io/service-account-token
EOF
secret/build-robot-secret created
```
<!--
Now you can confirm that the newly built secret is populated with an API token for the "build-robot" service account.
Any tokens for non-existent service accounts will be cleaned up by the token controller.
-->
现在,您可以确认新构建的 Secret 中填充了 "build-robot" 服务帐户的 API 令牌。
令牌控制器将清理不存在的服务帐户的所有令牌。
```shell
kubectl describe secrets/build-robot-secret
Name: build-robot-secret
Namespace: default
Labels: <none>
Annotations: kubernetes.io/service-account.name=build-robot
kubernetes.io/service-account.uid=da68f9c6-9d26-11e7-b84e-002dc52800da
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1338 bytes
namespace: 7 bytes
token: ...
```
{{< note >}}
<!--
The content of `token` is elided here.
-->
这里省略了 `token` 的内容。
{{< /note >}}
<!--
## Add ImagePullSecrets to a service account
First, create an imagePullSecret, as described [here](/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod).
Next, verify it has been created. For example:
-->
## 为服务账户添加 ImagePullSecrets
首先,创建一个 ImagePullSecrets,可以参考[这里](/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod) 的描述。
然后,确认创建是否成功。例如:
```shell
kubectl get secrets myregistrykey
NAME TYPE DATA AGE
myregistrykey   kubernetes.io/.dockerconfigjson   1       1d
```
<!--
Next, modify the default service account for the namespace to use this secret as an imagePullSecret.
-->
接着修改命名空间的默认服务帐户,以将该 Secret 用作 imagePullSecret。
```shell
kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "myregistrykey"}]}'
```
<!--
Interactive version requiring manual edit:
-->
需要手动编辑的交互式版本:
```shell
kubectl get serviceaccounts default -o yaml > ./sa.yaml
cat sa.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: 2015-08-07T22:02:39Z
name: default
namespace: default
resourceVersion: "243024"
selfLink: /api/v1/namespaces/default/serviceaccounts/default
uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6
secrets:
- name: default-token-uudge
vi sa.yaml
[editor session not shown]
[delete line with key "resourceVersion"]
[add lines with "imagePullSecrets:"]
cat sa.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: 2015-08-07T22:02:39Z
name: default
namespace: default
selfLink: /api/v1/namespaces/default/serviceaccounts/default
uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6
secrets:
- name: default-token-uudge
imagePullSecrets:
- name: myregistrykey
kubectl replace serviceaccount default -f ./sa.yaml
serviceaccounts/default
```
<!--
Now, any new pods created in the current namespace will have this added to their spec:
-->
现在,在当前命名空间中创建的每个新 Pod 的 spec 中都会添加下面的内容:
```yaml
spec:
imagePullSecrets:
- name: myregistrykey
```
<!--## Adding Secrets to a service account.
TODO: Test and explain how to use additional non-K8s secrets with an existing service account.
-->
<!--
## Service Account Token Volume Projection
-->
## 服务帐户令牌卷投影
{{< feature-state for_k8s_version="v1.12" state="beta" >}}
{{< note >}}
<!--
This ServiceAccountTokenVolumeProjection is __beta__ in 1.12 and
enabled by passing all of the following flags to the API server:
* `--service-account-issuer`
* `--service-account-signing-key-file`
* `--service-account-api-audiences`
-->
ServiceAccountTokenVolumeProjection 在 1.12 版本中是 __beta__ 阶段,可以通过向 API 服务器传递以下所有参数来启用它:
* `--service-account-issuer`
* `--service-account-signing-key-file`
* `--service-account-api-audiences`
{{< /note >}}
<--
The kubelet can also project a service account token into a Pod. You can
specify desired properties of the token, such as the audience and the validity
duration. These properties are not configurable on the default service account
token. The service account token will also become invalid against the API when
the Pod or the ServiceAccount is deleted.
-->
kubelet 还可以将服务帐户令牌投影到 Pod 中。
您可以指定令牌的所需属性,例如受众和有效持续时间。
这些属性在默认服务帐户令牌上无法配置。
当删除 Pod 或 ServiceAccount 时,服务帐户令牌也将对 API 无效。
<!--
This behavior is configured on a PodSpec using a ProjectedVolume type called
[ServiceAccountToken](/docs/concepts/storage/volumes/#projected). To provide a
pod with a token with an audience of "vault" and a validity duration of two
hours, you would configure the following in your PodSpec:
-->
使用名为 [ServiceAccountToken](/docs/concepts/storage/volumes/#projected) 的 ProjectedVolume 类型在 PodSpec 上配置此功能。
要向 Pod 提供具有 "vault" 观众以及两个小时有效期的令牌,可以在 PodSpec 中配置以下内容:
```yaml
kind: Pod
apiVersion: v1
spec:
containers:
- image: nginx
name: nginx
volumeMounts:
- mountPath: /var/run/secrets/tokens
name: vault-token
volumes:
- name: vault-token
projected:
sources:
- serviceAccountToken:
path: vault-token
expirationSeconds: 7200
audience: vault
```
<!--
The kubelet will request and store the token on behalf of the pod, make the
token available to the pod at a configurable file path, and refresh the token as
it approaches expiration. Kubelet proactively rotates the token if it is older
than 80% of its total TTL, or if the token is older than 24 hours.
The application is responsible for reloading the token when it rotates. Periodic
reloading (e.g. once every 5 minutes) is sufficient for most usecases.
-->
Kubelet 将代表 Pod 请求和存储令牌,使令牌在可配置的文件路径上对 Pod 可用,并在令牌接近到期时刷新令牌。
如果令牌存活时间大于其总 TTL 的 80% 或者大于 24 小时,Kubelet 则会主动旋转令牌。
应用程序负责在令牌旋转时重新加载令牌。
对于大多数情况,定期重新加载(例如,每 5 分钟一次)就足够了。
{{% /capture %}}
@@ -0,0 +1,198 @@
---
title: 配置 Pod 以使用卷进行存储
content_template: templates/task
weight: 50
---
<!--
---
title: Configure a Pod to Use a Volume for Storage
content_template: templates/task
weight: 50
---
-->
{{% capture overview %}}
此页面展示了如何配置 Pod 以使用卷进行存储。
只要容器存在,容器的文件系统就会存在,因此当一个容器终止并重新启动,对该容器的文件系统改动将丢失。对于独立于容器的持久化存储,您可以使用[](/docs/concepts/storage/volumes/)。这对于有状态应用程序尤为重要,例如键值存储(如 Redis)和数据库。
<!--
This page shows how to configure a Pod to use a Volume for storage.
A Container's file system lives only as long as the Container does. So when a
Container terminates and restarts, filesystem changes are lost. For more
consistent storage that is independent of the Container, you can use a
[Volume](/docs/concepts/storage/volumes/). This is especially important for stateful
applications, such as key-value stores (such as Redis) and databases.
-->
{{% /capture %}}
{{% capture prerequisites %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
{{% /capture %}}
{{% capture steps %}}
## 为 Pod 配置卷
在本练习中,您将创建一个运行 Pod,该 Pod 仅运行一个容器并拥有一个类型为 [emptyDir](/docs/concepts/storage/volumes/#emptydir) 的卷,在整个 Pod 生命周期中一直存在,即使 Pod 中的容器被终止和重启。以下是 Pod 的配置:
<!--
## Configure a volume for a Pod
In this exercise, you create a Pod that runs one Container. This Pod has a
Volume of type
[emptyDir](/docs/concepts/storage/volumes/#emptydir)
that lasts for the life of the Pod, even if the Container terminates and
restarts. Here is the configuration file for the Pod:
-->
{{< codenew file="pods/storage/redis.yaml" >}}
1. 创建 Pod:
<!--
1.Create the Pod:
-->
```shell
kubectl create -f https://k8s.io/examples/pods/storage/redis.yaml
```
1. 验证 Pod 中的容器是否正在运行,然后留意 Pod 的更改:
<!--
1.Verify that the Pod's Container is running, and then watch for changes to
the Pod:
-->
```shell
kubectl get pod redis --watch
```
输出如下:
```shell
NAME READY STATUS RESTARTS AGE
redis 1/1 Running 0 13s
```
1. 在另一个终端,用 shell 连接正在运行的容器:
<!--
1.In another terminal, get a shell to the running Container:
-->
```shell
kubectl exec -it redis -- /bin/bash
```
1. 在您的 shell 终端中,切换到 `/data/redis` 目录下,然后创建一个文件:
<!--
1.In your shell, go to `/data/redis`, and then create a file:
-->
```shell
root@redis:/data# cd /data/redis/
root@redis:/data/redis# echo Hello > test-file
```
1. 在您的 shell 终端中,列出正在运行的进程:
<!--
1.In your shell, list the running processes:
-->
```shell
root@redis:/data/redis# apt-get update
root@redis:/data/redis# apt-get install procps
root@redis:/data/redis# ps aux
```
输出类似于:
```shell
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
redis 1 0.1 0.1 33308 3828 ? Ssl 00:46 0:00 redis-server *:6379
root 12 0.0 0.0 20228 3020 ? Ss 00:47 0:00 /bin/bash
root 15 0.0 0.0 17500 2072 ? R+ 00:48 0:00 ps aux
```
1. 在您的 shell 终端中,结束 Redis 进程:
<!--
1.In your shell, kill the Redis process:
-->
```shell
root@redis:/data/redis# kill <pid>
```
其中 `<pid>` 是 Redis 进程的 ID (PID)。
1. 在您原先终端中,留意 Redis Pod 的更改。最终您将会看到和下面类似的输出:
<!--
1. In your original terminal, watch for changes to the Redis Pod. Eventually,
you will see something like this:
-->
```shell
NAME READY STATUS RESTARTS AGE
redis 1/1 Running 0 13s
redis 0/1 Completed 0 6m
redis 1/1 Running 1 6m
```
此时,容器已经终止并重新启动。这是因为 Redis Pod 的 [restartPolicy](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podspec-v1-core) 为 `Always`。
<!--
At this point, the Container has terminated and restarted. This is because the
Redis Pod has a
[restartPolicy](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podspec-v1-core)
of `Always`.
-->
1. 用 shell 终端进入重新启动的容器中:
<!--
1.Get a shell into the restarted Container:
-->
```shell
kubectl exec -it redis -- /bin/bash
```
1. 在您的 shell 终端中,进入到 `/data/redis` 目录下,并确认 `test-file` 文件是否仍然存在。
<!--
1.In your shell, goto `/data/redis`, and verify that `test-file` is still there.
-->
```shell
root@redis:/data/redis# cd /data/redis/
root@redis:/data/redis# ls
test-file
```
1. 删除为此练习所创建的 Pod
<!--
1.Delete the Pod that you created for this exercise:
-->
```shell
kubectl delete pod redis
```
{{% /capture %}}
{{% capture whatsnext %}}
* 参阅[卷](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#volume-v1-core)。
* 参阅 [Pod](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#pod-v1-core)。
* 除了 `emptyDir` 提供的本地磁盘存储外,Kubernetes 还支持许多不同的网络附加存储解决方案,包括 GCE 上的 PD 和 EC2 上的 EBS,它们是关键数据的首选,并将处理节点上的一些细节,例如安装和卸载设备。了解更多详情请参阅[卷](/docs/concepts/storage/volumes/)。
<!--
* See [Volume](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#volume-v1-core).
* See [Pod](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#pod-v1-core).
* In addition to the local disk storage provided by `emptyDir`, Kubernetes
supports many different network-attached storage solutions, including PD on
GCE and EBS on EC2, which are preferred for critical data and will handle
details such as mounting and unmounting the devices on the nodes. See
[Volumes](/docs/concepts/storage/volumes/) for more details.
-->
{{% /capture %}}
@@ -0,0 +1,235 @@
---
title: 为容器分派扩展资源
content_template: templates/task
weight: 40
---
<!--
---
title: Assign Extended Resources to a Container
content_template: templates/task
weight: 40
---
-->
{{% capture overview %}}
<!--
This page shows how to assign extended resources to a Container.
-->
本文介绍如何为容器指定扩展资源。
{{< feature-state state="stable" >}}
{{% /capture %}}
{{% capture prerequisites %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
<!--
Before you do this exercise, do the exercise in
[Advertise Extended Resources for a Node](/docs/tasks/administer-cluster/extended-resource-node/).
That will configure one of your Nodes to advertise a dongle resource.
-->
在您开始此练习前,请先练习[为节点广播扩展资源](/docs/tasks/administer-cluster/extended-resource-node/)。
在那个练习中将配置您的一个节点来广播 dongle 资源。
{{% /capture %}}
{{% capture steps %}}
<!--
## Assign an extended resource to a Pod
To request an extended resource, include the `resources:requests` field in your
Container manifest. Extended resources are fully qualified with any domain outside of
`*.kubernetes.io/`. Valid extended resource names have the form `example.com/foo` where
`example.com` is replaced with your organization's domain and `foo` is a
descriptive resource name.
Here is the configuration file for a Pod that has one Container:
-->
## 给 Pod 分派扩展资源
要请求扩展资源,需要在您的容器清单中包括 `resources:requests` 字段。
扩展资源可以使用任何完全限定名称,只是不能使用 `*.kubernetes.io/`
有效的扩展资源名的格式为 `example.com/foo`,其中 `example.com` 应被替换为您的组织的域名,而 `foo` 则是描述性的资源名称。
下面是包含一个容器的 Pod 配置文件:
{{< codenew file="pods/resource/extended-resource-pod.yaml" >}}
<!--
In the configuration file, you can see that the Container requests 3 dongles.
Create a Pod:
-->
在配置文件中,您可以看到容器请求了 3 个 dongles。
创建 Pod
```shell
kubectl create -f https://k8s.io/examples/pods/resource/extended-resource-pod.yaml
```
<!--
Verify that the Pod is running:
-->
检查 Pod 是否运行正常:
```shell
kubectl get pod extended-resource-demo
```
<!--
Describe the Pod:
-->
描述 Pod:
```shell
kubectl describe pod extended-resource-demo
```
<!--
The output shows dongle requests:
-->
输出结果显示 dongle 请求如下:
```yaml
Limits:
example.com/dongle: 3
Requests:
example.com/dongle: 3
```
<!--
## Attempt to create a second Pod
Here is the configuration file for a Pod that has one Container. The Container requests
two dongles.
-->
## 尝试创建第二个 Pod
下面是包含一个容器的 Pod 配置文件,容器请求了 2 个 dongles。
{{< codenew file="pods/resource/extended-resource-pod-2.yaml" >}}
<!--
Kubernetes will not be able to satisfy the request for two dongles, because the first Pod
used three of the four available dongles.
Attempt to create a Pod:
-->
Kubernetes 将不能满足 2 个 dongles 的请求,因为第一个 Pod 已经使用了 4 个可用 dongles 中的 3 个。
尝试创建 Pod
```shell
kubectl create -f https://k8s.io/examples/pods/resource/extended-resource-pod-2.yaml
```
<!--
Describe the Pod
-->
描述 Pod
```shell
kubectl describe pod extended-resource-demo-2
```
<!--
The output shows that the Pod cannot be scheduled, because there is no Node that has
2 dongles available:
-->
输出结果表明 Pod 不能被调度,因为没有一个节点上存在两个可用的 dongles。
```
Conditions:
Type Status
PodScheduled False
...
Events:
...
... Warning FailedScheduling pod (extended-resource-demo-2) failed to fit in any node
fit failure summary on nodes : Insufficient example.com/dongle (1)
```
<!--
View the Pod status:
-->
查看 Pod 的状态:
```shell
kubectl get pod extended-resource-demo-2
```
<!--
The output shows that the Pod was created, but not scheduled to run on a Node.
It has a status of Pending:
-->
输出结果表明 Pod 虽然被创建了,但没有被调度到节点上正常运行。Pod 的状态为 Pending
```yaml
NAME READY STATUS RESTARTS AGE
extended-resource-demo-2 0/1 Pending 0 6m
```
<!--
## Clean up
Delete the Pods that you created for this exercise:
-->
## 环境清理
删除本练习中创建的 Pod
```shell
kubectl delete pod extended-resource-demo
kubectl delete pod extended-resource-demo-2
```
{{% /capture %}}
{{% capture whatsnext %}}
<!--
### For application developers
* [Assign Memory Resources to Containers and Pods](/docs/tasks/configure-pod-container/assign-memory-resource/)
* [Assign CPU Resources to Containers and Pods](/docs/tasks/configure-pod-container/assign-cpu-resource/)
-->
## 应用开发者参考
* [为容器和 Pod 分配内存资源](/docs/tasks/configure-pod-container/assign-memory-resource/)
* [为容器和 Pod 分配 CPU 资源](/docs/tasks/configure-pod-container/assign-cpu-resource/)
<!--
### For cluster administrators
* [Advertise Extended Resources for a Node](/docs/tasks/administer-cluster/extended-resource-node/)
-->
### 集群管理员参考
* [为节点广播扩展资源](/docs/tasks/administer-cluster/extended-resource-node/)
{{% /capture %}}
@@ -0,0 +1,286 @@
---
title: 从私有仓库拉取镜像
content_template: templates/task
weight: 100
---
<!--
---
title: Pull an Image from a Private Registry
content_template: templates/task
weight: 100
---
-->
{{% capture overview %}}
<!--
This page shows how to create a Pod that uses a Secret to pull an image from a
private Docker registry or repository.
-->
本文介绍如何使用 Secret 从私有的 Docker 镜像仓库或代码仓库拉取镜像来创建 Pod。
{{% /capture %}}
{{% capture prerequisites %}}
* {{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
<!--
* To do this exercise, you need a
[Docker ID](https://docs.docker.com/docker-id/) and password.
-->
您需要 [Docker ID](https://docs.docker.com/docker-id/) 和密码来进行本练习。
{{% /capture %}}
{{% capture steps %}}
<!--
## Log in to Docker
On your laptop, you must authenticate with a registry in order to pull a private image:
-->
## 登录 Docker 镜像仓库
在个人电脑上,要想拉取私有镜像必须在镜像仓库上进行身份验证。
```shell
docker login
```
<!--
When prompted, enter your Docker username and password.
The login process creates or updates a `config.json` file that holds an authorization token.
View the `config.json` file:
-->
当提示时,输入 Docker 用户名和密码。
登录过程会创建或更新保存有授权令牌的 `config.json` 文件。
查看 `config.json` 文件:
```shell
cat ~/.docker/config.json
```
<!--
The output contains a section similar to this:
-->
输出结果包含类似于以下内容的部分:
```json
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "c3R...zE2"
}
}
}
```
{{< note >}}
<!--
If you use a Docker credentials store, you won't see that `auth` entry but a `credsStore` entry with the name of the store as value.
-->
如果使用 Docker 凭证仓库,则不会看到 `auth` 条目,看到的将是以仓库名称作为值的 `credsStore` 条目。
{{< /note >}}
<!--
## Create a Secret in the cluster that holds your authorization token
A Kubernetes cluster uses the Secret of `docker-registry` type to authenticate with a container registry to pull a private image.
Create this Secret, naming it `regcred`:
-->
## 在集群中创建保存授权令牌的 Secret
Kubernetes 集群使用 `docker-registry` 类型的 Secret 来通过容器仓库的身份验证,进而提取私有映像。
创建 Secret,命名为 `regcred`
```shell
kubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>
```
<!--
where:
* `<your-registry-server>` is your Private Docker Registry FQDN. (https://index.docker.io/v1/ for DockerHub)
* `<your-name>` is your Docker username.
* `<your-pword>` is your Docker password.
* `<your-email>` is your Docker email.
You have successfully set your Docker credentials in the cluster as a Secret called `regcred`.
-->
在这里:
* `<your-registry-server>` 是你的私有 Docker 仓库全限定域名(FQDN)。(参考 https://index.docker.io/v1/ 中关于 DockerHub 的部分)
* `<your-name>` 是你的 Docker 用户名。
* `<your-pword>` 是你的 Docker 密码。
* `<your-email>` 是你的 Docker 邮箱。
这样您就成功地将集群中的 Docker 凭据设置为名为 `regcred` 的 Secret。
<!--
## Inspecting the Secret `regcred`
To understand the contents of the `regcred` Secret you just created, start by viewing the Secret in YAML format:
-->
## 检查 Secret `regcred`
要了解你创建的 `regcred` Secret 的内容,可以用 YAML 格式进行查看:
```shell
kubectl get secret regcred --output=yaml
```
<!--
The output is similar to this:
-->
输出和下面类似:
```yaml
apiVersion: v1
data:
.dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=
kind: Secret
metadata:
...
name: regcred
...
type: kubernetes.io/dockerconfigjson
```
<!--
The value of the `.dockerconfigjson` field is a base64 representation of your Docker credentials.
To understand what is in the `.dockerconfigjson` field, convert the secret data to a
readable format:
-->
`.dockerconfigjson` 字段的值是 Docker 凭据的 base64 表示。
要了解 `dockerconfigjson` 字段中的内容,请将 Secret 数据转换为可读格式:
```shell
kubectl get secret regcred --output="jsonpath={.data.\.dockerconfigjson}" | base64 --decode
```
<!--
The output is similar to this:
-->
输出和下面类似:
```json
{"auths":{"yourprivateregistry.com":{"username":"janedoe","password":"xxxxxxxxxxx","email":"jdoe@example.com","auth":"c3R...zE2"}}}
```
<!--
To understand what is in the `auth` field, convert the base64-encoded data to a readable format:
-->
要了解 `auth` 字段中的内容,请将 base64 编码过的数据转换为可读格式:
```shell
echo "c3R...zE2" | base64 --decode
```
<!--
The output, username and password concatenated with a `:`, is similar to this:
-->
输出结果中,用户名和密码用 `:` 链接,类似下面这样:
```none
janedoe:xxxxxxxxxxx
```
<!--
Notice that the Secret data contains the authorization token similar to your local `~/.docker/config.json` file.
You have successfully set your Docker credentials as a Secret called `regcred` in the cluster.
## Create a Pod that uses your Secret
Here is a configuration file for a Pod that needs access to your Docker credentials in `regcred`:
-->
注意,Secret 数据包含与本地 `~/.docker/config.json` 文件类似的授权令牌。
这样您就已经成功地将 Docker 凭据设置为集群中的名为 `regcred` 的 Secret。
## 创建一个使用您的 Secret 的 Pod
下面是一个 Pod 配置文件,它需要访问 `regcred` 中的 Docker 凭据:
{{< codenew file="pods/private-reg-pod.yaml" >}}
<!--
Download the above file:
-->
下载上述文件:
```shell
wget -O my-private-reg-pod.yaml https://k8s.io/examples/pods/private-reg-pod.yaml
```
<!--
In file `my-private-reg-pod.yaml`, replace `<your-private-image>` with the path to an image in a private registry such as:
-->
`my-private-reg-pod.yaml` 文件中,使用私有仓库的镜像路径替换 `<your-private-image>`,例如:
```none
janedoe/jdoe-private:v1
```
<!--
To pull the image from the private registry, Kubernetes needs credentials.
The `imagePullSecrets` field in the configuration file specifies that Kubernetes should get the credentials from a Secret named `regcred`.
Create a Pod that uses your Secret, and verify that the Pod is running:
-->
要从私有仓库拉取镜像,Kubernetes 需要凭证。
配置文件中的 `imagePullSecrets` 字段表明 Kubernetes 应该通过名为 `regcred` 的 Secret 获取凭证。
创建使用了你的 Secret 的 Pod,并检查它是否正常运行:
```shell
kubectl create -f my-private-reg-pod.yaml
kubectl get pod private-reg
```
{{% /capture %}}
{{% capture whatsnext %}}
<!--
* Learn more about [Secrets](/docs/concepts/configuration/secret/).
* Learn more about [using a private registry](/docs/concepts/containers/images/#using-a-private-registry).
* See [kubectl create secret docker-registry](/docs/reference/generated/kubectl/kubectl-commands/#-em-secret-docker-registry-em-).
* See [Secret](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#secret-v1-core).
* See the `imagePullSecrets` field of [PodSpec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podspec-v1-core).
-->
* 进一步了解 [Secrets](/docs/concepts/configuration/secret/)。
* 进一步了解 [使用私有仓库](/docs/concepts/containers/images/#using-a-private-registry)。
* 参考 [kubectl create secret docker-registry](/docs/reference/generated/kubectl/kubectl-commands/#-em-secret-docker-registry-em-)。
* 参考 [Secret](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#secret-v1-core)。
* 参考 [PodSpec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podspec-v1-core) 中的 `imagePullSecrets` 字段 。
{{% /capture %}}
@@ -0,0 +1,440 @@
---
title: 配置 Pod 的服务质量
content_template: templates/task
weight: 30
---
<!--
---
title: Configure Quality of Service for Pods
content_template: templates/task
weight: 30
---
-->
{{% capture overview %}}
<!--
This page shows how to configure Pods so that they will be assigned particular
Quality of Service (QoS) classes. Kubernetes uses QoS classes to make decisions about
scheduling and evicting Pods.
-->
本文介绍怎样配置 Pod 让其获得特定的服务质量(QoS)类。Kubernetes 使用 QoS 类来决定 Pod 的调度和驱逐策略。
{{% /capture %}}
{{% capture prerequisites %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
{{% /capture %}}
{{% capture steps %}}
<!--
## QoS classes
When Kubernetes creates a Pod it assigns one of these QoS classes to the Pod:
-->
## QoS 类
Kubernetes 创建 Pod 时就给它指定了下列一种 QoS 类:
* Guaranteed
* Burstable
* BestEffort
<!--
## Create a namespace
Create a namespace so that the resources you create in this exercise are
isolated from the rest of your cluster.
-->
## 创建命名空间
创建一个命名空间,以便将本练习所创建的资源与集群的其余资源相隔离。
```shell
kubectl create namespace qos-example
```
<!--
## Create a Pod that gets assigned a QoS class of Guaranteed
For a Pod to be given a QoS class of Guaranteed:
* Every Container in the Pod must have a memory limit and a memory request, and they must be the same.
* Every Container in the Pod must have a CPU limit and a CPU request, and they must be the same.
Here is the configuration file for a Pod that has one Container. The Container has a memory limit and a
memory request, both equal to 200 MiB. The Container has a CPU limit and a CPU request, both equal to 700 milliCPU:
-->
## 创建一个 QoS 类为 Guaranteed 的 Pod
对于 QoS 类为 Guaranteed 的 Pod
* Pod 中的每个容器必须指定内存请求和内存限制,并且两者要相等。
* Pod 中的每个容器必须指定 CPU 请求和 CPU 限制,并且两者要相等。
下面是包含一个容器的 Pod 配置文件。
容器设置了内存请求和内存限制,值都是 200 MiB。
容器设置了 CPU 请求和 CPU 限制,值都是 700 milliCPU
{{< codenew file="pods/qos/qos-pod.yaml" >}}
<!--
Create the Pod:
-->
创建 Pod
```shell
kubectl create -f https://k8s.io/examples/pods/qos/qos-pod.yaml --namespace=qos-example
```
<!--
View detailed information about the Pod:
-->
查看 Pod 详情:
```shell
kubectl get pod qos-demo --namespace=qos-example --output=yaml
```
<!--
The output shows that Kubernetes gave the Pod a QoS class of Guaranteed. The output also
verifies that the Pod Container has a memory request that matches its memory limit, and it has
a CPU request that matches its CPU limit.
-->
结果表明 Kubernetes 为 Pod 配置的 QoS 类为 Guaranteed。
结果也确认了 Pod 容器设置了与内存限制匹配的内存请求,设置了与 CPU 限制匹配的 CPU 请求。
```yaml
spec:
containers:
...
resources:
limits:
cpu: 700m
memory: 200Mi
requests:
cpu: 700m
memory: 200Mi
...
qosClass: Guaranteed
```
{{< note >}}
<!--
If a Container specifies its own memory limit, but does not specify a memory request, Kubernetes
automatically assigns a memory request that matches the limit. Similarly, if a Container specifies its own
CPU limit, but does not specify a CPU request, Kubernetes automatically assigns a CPU request that matches
the limit.
-->
如果容器指定了自己的内存限制,但没有指定内存请求,Kubernetes 会自动为它指定与内存限制匹配的内存请求。
同样,如果容器指定了自己的 CPU 限制,但没有指定 CPU 请求,Kubernetes 会自动为它指定与 CPU 限制匹配的 CPU 请求。
{{< /note >}}
<!--
Delete your Pod:
-->
删除 Pod
```shell
kubectl delete pod qos-demo --namespace=qos-example
```
<!--
## Create a Pod that gets assigned a QoS class of Burstable
A Pod is given a QoS class of Burstable if:
* The Pod does not meet the criteria for QoS class Guaranteed.
* At least one Container in the Pod has a memory or CPU request.
Here is the configuration file for a Pod that has one Container. The Container has a memory limit of 200 MiB
and a memory request of 100 MiB.
-->
## 创建一个 QoS 类为 Burstable 的 Pod
如果满足下面条件,将会指定 Pod 的 QoS 类为 Burstable
* Pod 不符合 Guaranteed QoS 类的标准。
* Pod 中至少一个容器具有内存或 CPU 请求。
下面是包含一个容器的 Pod 配置文件。
容器设置了内存限制 200 MiB 和内存请求 100 MiB。
{{< codenew file="pods/qos/qos-pod-2.yaml" >}}
<!--
Create the Pod:
-->
创建 Pod
```shell
kubectl create -f https://k8s.io/examples/pods/qos/qos-pod-2.yaml --namespace=qos-example
```
<!--
View detailed information about the Pod:
-->
查看 Pod 详情:
```shell
kubectl get pod qos-demo-2 --namespace=qos-example --output=yaml
```
<!--
The output shows that Kubernetes gave the Pod a QoS class of Burstable.
-->
结果表明 Kubernetes 为 Pod 配置的 QoS 类为 Burstable。
```yaml
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: qos-demo-2-ctr
resources:
limits:
memory: 200Mi
requests:
memory: 100Mi
...
qosClass: Burstable
```
<!--
Delete your Pod:
-->
删除 Pod
```shell
kubectl delete pod qos-demo-2 --namespace=qos-example
```
<!--
## Create a Pod that gets assigned a QoS class of BestEffort
For a Pod to be given a QoS class of BestEffort, the Containers in the Pod must not
have any memory or CPU limits or requests.
Here is the configuration file for a Pod that has one Container. The Container has no memory or CPU
limits or requests:
-->
## 创建一个 QoS 类为 BestEffort 的 Pod
对于 QoS 类为 BestEffort 的 Pod,Pod 中的容器必须没有设置内存和 CPU 限制或请求。
下面是包含一个容器的 Pod 配置文件。
容器没有设置内存和 CPU 限制或请求。
{{< codenew file="pods/qos/qos-pod-3.yaml" >}}
<!--
Create the Pod:
-->
创建 Pod
```shell
kubectl create -f https://k8s.io/examples/pods/qos/qos-pod-3.yaml --namespace=qos-example
```
<!--
View detailed information about the Pod:
-->
查看 Pod 详情:
```shell
kubectl get pod qos-demo-3 --namespace=qos-example --output=yaml
```
<!--
The output shows that Kubernetes gave the Pod a QoS class of BestEffort.
-->
结果表明 Kubernetes 为 Pod 配置的 QoS 类为 BestEffort。
```yaml
spec:
containers:
...
resources: {}
...
qosClass: BestEffort
```
<!--
Delete your Pod:
-->
删除 Pod
```shell
kubectl delete pod qos-demo-3 --namespace=qos-example
```
<!--
## Create a Pod that has two Containers
Here is the configuration file for a Pod that has two Containers. One container specifies a memory
request of 200 MiB. The other Container does not specify any requests or limits.
-->
## 创建包含两个容器的 Pod
下面是包含两个容器的 Pod 配置文件。
一个容器指定了内存请求 200 MiB。
另外一个容器没有指定任何请求和限制。
{{< codenew file="pods/qos/qos-pod-4.yaml" >}}
<!--
Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the
criteria for QoS class Guaranteed, and one of its Containers has a memory request.
Create the Pod:
-->
注意此 Pod 满足 Burstable QoS 类的标准。
也就是说它不满足 Guaranteed QoS 类标准,因为它的一个容器设有内存请求。
创建 Pod
```shell
kubectl create -f https://k8s.io/examples/pods/qos/qos-pod-4.yaml --namespace=qos-example
```
<!--
View detailed information about the Pod:
-->
查看 Pod 详情:
```shell
kubectl get pod qos-demo-4 --namespace=qos-example --output=yaml
```
<!--
The output shows that Kubernetes gave the Pod a QoS class of Burstable:
-->
结果表明 Kubernetes 为 Pod 配置的 QoS 类为 Burstable
```yaml
spec:
containers:
...
name: qos-demo-4-ctr-1
resources:
requests:
memory: 200Mi
...
name: qos-demo-4-ctr-2
resources: {}
...
qosClass: Burstable
```
<!--
Delete your Pod:
-->
删除 Pod
```shell
kubectl delete pod qos-demo-4 --namespace=qos-example
```
<!--
## Clean up
Delete your namespace:
-->
## 环境清理
删除命名空间:
```shell
kubectl delete namespace qos-example
```
{{% /capture %}}
{{% capture whatsnext %}}
<!--
### For app developers
* [Assign Memory Resources to Containers and Pods](/docs/tasks/configure-pod-container/assign-memory-resource/)
* [Assign CPU Resources to Containers and Pods](/docs/tasks/configure-pod-container/assign-cpu-resource/)
-->
### 应用开发者参考
* [为 Pod 和容器分配内存资源](/docs/tasks/configure-pod-container/assign-memory-resource/)
* [为 Pod 和容器分配 CPU 资源](/docs/tasks/configure-pod-container/assign-cpu-resource/)
<!--
### For cluster administrators
* [Configure Default Memory Requests and Limits for a Namespace](/docs/tasks/administer-cluster/memory-default-namespace/)
* [Configure Default CPU Requests and Limits for a Namespace](/docs/tasks/administer-cluster/cpu-default-namespace/)
* [Configure Minimum and Maximum Memory Constraints for a Namespace](/docs/tasks/administer-cluster/memory-constraint-namespace/)
* [Configure Minimum and Maximum CPU Constraints for a Namespace](/docs/tasks/administer-cluster/cpu-constraint-namespace/)
* [Configure Memory and CPU Quotas for a Namespace](/docs/tasks/administer-cluster/quota-memory-cpu-namespace/)
* [Configure a Pod Quota for a Namespace](/docs/tasks/administer-cluster/quota-pod-namespace/)
* [Configure Quotas for API Objects](/docs/tasks/administer-cluster/quota-api-object/)
-->
### 集群管理员参考
* [为命名空间配置默认的内存请求和限制](/docs/tasks/administer-cluster/memory-default-namespace/)
* [为命名空间配置默认的 CPU 请求和限制](/docs/tasks/administer-cluster/cpu-default-namespace/)
* [为命名空间配置最小和最大内存限制](/docs/tasks/administer-cluster/memory-constraint-namespace/)
* [为命名空间配置最小和最大 CPU 限制](/docs/tasks/administer-cluster/cpu-constraint-namespace/)
* [为命名空间配置内存和 CPU 配额](/docs/tasks/administer-cluster/quota-memory-cpu-namespace/)
* [为命名空间配置 Pod 配额](/docs/tasks/administer-cluster/quota-pod-namespace/)
* [为 API 对象配置配额](/docs/tasks/administer-cluster/quota-api-object/)
{{% /capture %}}
@@ -0,0 +1,187 @@
---
title: 在 Pod 中的容器之间共享进程命名空间
min-kubernetes-server-version: v1.10
content_template: templates/task
weight: 160
---
<!--
---
title: Share Process Namespace between Containers in a Pod
min-kubernetes-server-version: v1.10
reviewers:
- verb
- yujuhong
- dchen1107
content_template: templates/task
weight: 160
---
-->
{{% capture overview %}}
{{< feature-state state="beta" >}}
<!--
This page shows how to configure process namespace sharing for a pod. When
process namespace sharing is enabled, processes in a container are visible
to all other containers in that pod.
-->
此页面展示如何为 pod 配置进程命名空间共享。
当启用进程命名空间共享时,容器中的进程对该 pod 中的所有其他容器都是可见的。
<!--
You can use this feature to configure cooperating containers, such as a log
handler sidecar container, or to troubleshoot container images that don't
include debugging utilities like a shell.
-->
您可以使用此功能来配置协作容器,比如日志处理 sidecar 容器,或者对那些不包含诸如 shell 等调试实用工具的镜像进行故障排查。
{{% /capture %}}
{{% capture prerequisites %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
<!--
Process Namespace Sharing is a **beta** feature that is enabled by default. It
may be disabled by setting `--feature-gates=PodShareProcessNamespace=false`.
-->
进程命名空间共享是默认启用的 **beta** 版功能。
您可以通过设置 `--feature-gates=PodShareProcessNamespace=false` 禁用此功能。
{{% /capture %}}
{{% capture steps %}}
<!--
## Configure a Pod
-->
## 配置 Pod
<!--
Process Namespace Sharing is enabled using the `ShareProcessNamespace` field of
`v1.PodSpec`. For example:
-->
进程命名空间共享使用 `v1.PodSpec` 中的 `ShareProcessNamespace` 字段启用。例如:
{{< codenew file="pods/share-process-namespace.yaml" >}}
<!--
1. Create the pod `nginx` on your cluster:
kubectl create -f https://k8s.io/examples/pods/share-process-namespace.yaml
2. Attach to the `shell` container and run `ps`:
```
kubectl attach -it nginx -c shell
```
If you don't see a command prompt, try pressing enter.
```
/ # ps ax
PID USER TIME COMMAND
1 root 0:00 /pause
8 root 0:00 nginx: master process nginx -g daemon off;
14 101 0:00 nginx: worker process
15 root 0:00 sh
21 root 0:00 ps ax
```
-->
1. 在集群中创建 `nginx` pod
kubectl create -f https://k8s.io/examples/pods/share-process-namespace.yaml
2. 获取容器 `shell`,执行 `ps`
```
kubectl attach -it nginx -c shell
```
如果没有看到命令提示符,请按 enter 回车键。
```
/ # ps ax
PID USER TIME COMMAND
1 root 0:00 /pause
8 root 0:00 nginx: master process nginx -g daemon off;
14 101 0:00 nginx: worker process
15 root 0:00 sh
21 root 0:00 ps ax
```
<!--
You can signal processes in other containers. For example, send `SIGHUP` to
nginx to restart the worker process. This requires the `SYS_PTRACE` capability.
-->
您可以在其他容器中对进程发出信号。例如,发送 `SIGHUP` 到 nginx 以重启工作进程。这需要 `SYS_PTRACE` 功能。
/ # kill -HUP 8
/ # ps ax
PID USER TIME COMMAND
1 root 0:00 /pause
8 root 0:00 nginx: master process nginx -g daemon off;
15 root 0:00 sh
22 101 0:00 nginx: worker process
23 root 0:00 ps ax
<!--
It's even possible to access another container image using the
`/proc/$pid/root` link.
-->
甚至可以使用 `/proc/$pid/root` 链接访问另一个容器镜像。
/ # head /proc/8/root/etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
{{% /capture %}}
{{% capture discussion %}}
<!--
## Understanding Process Namespace Sharing
-->
## 理解进程命名空间共享
<!--
Pods share many resources so it makes sense they would also share a process
namespace. Some container images may expect to be isolated from other
containers, though, so it's important to understand these differences:
-->
Pod 共享许多资源,因此它们共享进程命名空间是很有意义的。
不过,有些容器镜像可能希望与其他容器隔离,因此了解这些差异很重要:
<!--
1. **The container process no longer has PID 1.** Some container images refuse
to start without PID 1 (for example, containers using `systemd`) or run
commands like `kill -HUP 1` to signal the container process. In pods with a
shared process namespace, `kill -HUP 1` will signal the pod sandbox.
(`/pause` in the above example.)
2. **Processes are visible to other containers in the pod.** This includes all
information visible in `/proc`, such as passwords that were passed as arguments
or environment variables. These are protected only by regular Unix permissions.
3. **Container filesystems are visible to other containers in the pod through the
`/proc/$pid/root` link.** This makes debugging easier, but it also means
that filesystem secrets are protected only by filesystem permissions.
-->
1. **容器进程不再具有 PID 1。** 在没有 PID 1 的情况下,一些容器镜像拒绝启动(例如,使用 `systemd` 的容器),或者拒绝执行 `kill -HUP 1` 之类的命令来通知容器进程。在具有共享进程命名空间的 pod 中,`kill -HUP 1` 将通知 pod 沙箱(在上面的例子中是 `/pause`)。
2. **进程对 pod 中的其他容器可见。** 这包括 `/proc` 中可见的所有信息,例如作为参数或环境变量传递的密码。这些仅受常规 Unix 权限的保护。
3. **容器文件系统通过 `/proc/$pid/root` 链接对 pod 中的其他容器可见。** 这使调试更加容易,但也意味着文件系统安全性只受文件系统权限的保护。
{{% /capture %}}
@@ -0,0 +1,844 @@
---
reviewers:
- cdrage
title: 将 Docker Compose 文件转换为 Kubernetes 资源
content_template: templates/task
weight: 170
---
<!--
---
reviewers:
- cdrage
title: Translate a Docker Compose File to Kubernetes Resources
content_template: templates/task
weight: 170
---
-->
{{% capture overview %}}
<!--
What's Kompose? It's a conversion tool for all things compose (namely Docker Compose) to container orchestrators (Kubernetes or OpenShift).
-->
Kompose 是什么?它是个转换工具,可将 compose(即 Docker Compose)所组装的所有内容转换成容器编排器(Kubernetes 或 OpenShift)可识别的形式。
<!--
More information can be found on the Kompose website at [http://kompose.io](http://kompose.io).
-->
更多信息请参考 Kompose 官网 [http://kompose.io](http://kompose.io)。
{{% /capture %}}
{{% capture prerequisites %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
{{% /capture %}}
{{% capture steps %}}
<!--
## Install Kompose
-->
## 安装 Kompose
<!--
We have multiple ways to install Kompose. Our preferred method is downloading the binary from the latest GitHub release.
-->
我们有很多种方式安装 Kompose。首选方式是从最新的 GitHub 发布页面下载二进制文件。
<!--
## GitHub release
-->
## GitHub 发布版本
<!--
Kompose is released via GitHub on a three-week cycle, you can see all current releases on the [GitHub release page](https://github.com/kubernetes/kompose/releases).
-->
Kompose 通过 GitHub 发布版本,发布周期为三星期。您可以在[GitHub 发布页面](https://github.com/kubernetes/kompose/releases)上看到所有当前版本。
```sh
# Linux
curl -L https://github.com/kubernetes/kompose/releases/download/v1.16.0/kompose-linux-amd64 -o kompose
# macOS
curl -L https://github.com/kubernetes/kompose/releases/download/v1.16.0/kompose-darwin-amd64 -o kompose
# Windows
curl -L https://github.com/kubernetes/kompose/releases/download/v1.16.0/kompose-windows-amd64.exe -o kompose.exe
chmod +x kompose
sudo mv ./kompose /usr/local/bin/kompose
```
<!--
Alternatively, you can download the [tarball](https://github.com/kubernetes/kompose/releases).
-->
或者,您可以下载 [tarball](https://github.com/kubernetes/kompose/releases)。
## Go
<!--
Installing using `go get` pulls from the master branch with the latest development changes.
-->
`go get` 命令从主分支拉取最新的开发变更的方法安装 Kompose。
```sh
go get -u github.com/kubernetes/kompose
```
## CentOS
<!--
Kompose is in [EPEL](https://fedoraproject.org/wiki/EPEL) CentOS repository.
If you don't have [EPEL](https://fedoraproject.org/wiki/EPEL) repository already installed and enabled you can do it by running `sudo yum install epel-release`
-->
Kompose 位于 [EPEL](https://fedoraproject.org/wiki/EPEL) CentOS 代码仓库。
如果您还没有安装启用 [EPEL](https://fedoraproject.org/wiki/EPEL) 代码仓库,请运行命令 `sudo yum install epel-release`
<!--
If you have [EPEL](https://fedoraproject.org/wiki/EPEL) enabled in your system, you can install Kompose like any other package.
-->
如果您的系统中已经启用了 [EPEL](https://fedoraproject.org/wiki/EPEL),您就可以像安装其他软件包一样安装 Kompose。
```bash
sudo yum -y install kompose
```
## Fedora
<!--
Kompose is in Fedora 24, 25 and 26 repositories. You can install it just like any other package.
-->
Kompose 位于 Fedora 24、25 和 26 的代码仓库。您可以像安装其他软件包一样安装 Kompose。
```bash
sudo dnf -y install kompose
```
## macOS
<!--
On macOS you can install latest release via [Homebrew](https://brew.sh):
-->
在 macOS 上您可以通过 [Homebrew](https://brew.sh) 安装 Kompose 的最新版本:
```bash
brew install kompose
```
<!--
## Use Kompose
-->
## 使用 Kompose
<!--
In just a few steps, we'll take you from Docker Compose to Kubernetes. All
you need is an existing `docker-compose.yml` file.
-->
再需几步,我们就把你从 Docker Compose 带到 Kubernetes。
您只需要一个现有的 `docker-compose.yml` 文件。
1. <!--Go to the directory containing your `docker-compose.yml` file. If you don't
have one, test using this one.-->
进入 `docker-compose.yml` 文件所在的目录。如果没有,请使用下面这个进行测试。
```yaml
version: "2"
services:
redis-master:
image: k8s.gcr.io/redis:e2e
ports:
- "6379"
redis-slave:
image: gcr.io/google_samples/gb-redisslave:v1
ports:
- "6379"
environment:
- GET_HOSTS_FROM=dns
frontend:
image: gcr.io/google-samples/gb-frontend:v4
ports:
- "80:80"
environment:
- GET_HOSTS_FROM=dns
labels:
kompose.service.type: LoadBalancer
```
2. <!--Run the `kompose up` command to deploy to Kubernetes directly, or skip to
the next step instead to generate a file to use with `kubectl`.-->
运行 `kompose up` 命令直接部署到 Kubernetes,或者跳到下一步,生成 `kubectl` 使用的文件。
```bash
$ kompose up
We are going to create Kubernetes Deployments, Services and PersistentVolumeClaims for your Dockerized application.
If you need different kind of resources, use the 'kompose convert' and 'kubectl create -f' commands instead.
INFO Successfully created Service: redis
INFO Successfully created Service: web
INFO Successfully created Deployment: redis
INFO Successfully created Deployment: web
Your application has been deployed to Kubernetes. You can run 'kubectl get deployment,svc,pods,pvc' for details.
```
3. <!--To convert the `docker-compose.yml` file to files that you can use with
`kubectl`, run `kompose convert` and then `kubectl create -f <output file>`.-->
要将 `docker-compose.yml` 转换为 `kubectl` 可用的文件,请运行 `kompose convert` 命令进行转换,然后运行 `kubectl create -f <output file>` 进行创建。
```bash
$ kompose convert
INFO Kubernetes file "frontend-service.yaml" created
INFO Kubernetes file "redis-master-service.yaml" created
INFO Kubernetes file "redis-slave-service.yaml" created
INFO Kubernetes file "frontend-deployment.yaml" created
INFO Kubernetes file "redis-master-deployment.yaml" created
INFO Kubernetes file "redis-slave-deployment.yaml" created
```
```bash
$ kubectl create -f frontend-service.yaml,redis-master-service.yaml,redis-slave-service.yaml,frontend-deployment.yaml,redis-master-deployment.yaml,redis-slave-deployment.yaml
service/frontend created
service/redis-master created
service/redis-slave created
deployment.apps/frontend created
deployment.apps/redis-master created
deployment.apps/redis-slave created
```
<!--
Your deployments are running in Kubernetes.
-->
您部署的应用在 Kubernetes 中运行起来了。
4. <!--Access your application.-->访问您的应用。
<!--If you're already using `minikube` for your development process:-->
如果您在开发过程中使用 `minikube`,请执行:
```bash
$ minikube service frontend
```
<!--Otherwise, let's look up what IP your service is using!-->
否则,我们要查看一下您的服务使用了什么 IP!
```sh
$ kubectl describe svc frontend
Name: frontend
Namespace: default
Labels: service=frontend
Selector: service=frontend
Type: LoadBalancer
IP: 10.0.0.183
LoadBalancer Ingress: 123.45.67.89
Port: 80 80/TCP
NodePort: 80 31144/TCP
Endpoints: 172.17.0.4:80
Session Affinity: None
No events.
```
<!--If you're using a cloud provider, your IP will be listed next to `LoadBalancer Ingress`.-->
如果您使用的是云提供商,您的 IP 将在 `LoadBalancer Ingress` 字段给出。
```sh
$ curl http://123.45.67.89
```
{{% /capture %}}
{{% capture discussion %}}
<!--
## User Guide
-->
## 用户指南
<!--
- CLI
- [`kompose convert`](#kompose-convert)
- [`kompose up`](#kompose-up)
- [`kompose down`](#kompose-down)
- Documentation
- [Build and Push Docker Images](#build-and-push-docker-images)
- [Alternative Conversions](#alternative-conversions)
- [Labels](#labels)
- [Restart](#restart)
- [Docker Compose Versions](#docker-compose-versions)
-->
- CLI
- [`kompose convert`](#kompose-convert)
- [`kompose up`](#kompose-up)
- [`kompose down`](#kompose-down)
- 文档
- [构建和推送 Docker 镜像](#构建和推送-docker-镜像)
- [其他转换方式](#其他转换方式)
- [标签](#标签)
- [重启](#重启)
- [Docker Compose 版本](#docker-compose-版本)
<!--
Kompose has support for two providers: OpenShift and Kubernetes.
You can choose a targeted provider using global option `--provider`. If no provider is specified, Kubernetes is set by default.
-->
Kompose 支持两种驱动:OpenShift 和 Kubernetes。
您可以通过全局选项 `--provider` 选择驱动方式。如果没有指定,会将 Kubernetes 作为默认驱动。
## `kompose convert`
Kompose 支持将 V1、V2 和 V3 版本的 Docker Compose 文件转换为 Kubernetes 和 OpenShift 资源对象。
### Kubernetes
```sh
$ kompose --file docker-voting.yml convert
WARN Unsupported key networks - ignoring
WARN Unsupported key build - ignoring
INFO Kubernetes file "worker-svc.yaml" created
INFO Kubernetes file "db-svc.yaml" created
INFO Kubernetes file "redis-svc.yaml" created
INFO Kubernetes file "result-svc.yaml" created
INFO Kubernetes file "vote-svc.yaml" created
INFO Kubernetes file "redis-deployment.yaml" created
INFO Kubernetes file "result-deployment.yaml" created
INFO Kubernetes file "vote-deployment.yaml" created
INFO Kubernetes file "worker-deployment.yaml" created
INFO Kubernetes file "db-deployment.yaml" created
$ ls
db-deployment.yaml docker-compose.yml docker-gitlab.yml redis-deployment.yaml result-deployment.yaml vote-deployment.yaml worker-deployment.yaml
db-svc.yaml docker-voting.yml redis-svc.yaml result-svc.yaml vote-svc.yaml worker-svc.yaml
```
<!--
You can also provide multiple docker-compose files at the same time:
-->
您也可以同时提供多个 docker-compose 文件进行转换:
```sh
$ kompose -f docker-compose.yml -f docker-guestbook.yml convert
INFO Kubernetes file "frontend-service.yaml" created
INFO Kubernetes file "mlbparks-service.yaml" created
INFO Kubernetes file "mongodb-service.yaml" created
INFO Kubernetes file "redis-master-service.yaml" created
INFO Kubernetes file "redis-slave-service.yaml" created
INFO Kubernetes file "frontend-deployment.yaml" created
INFO Kubernetes file "mlbparks-deployment.yaml" created
INFO Kubernetes file "mongodb-deployment.yaml" created
INFO Kubernetes file "mongodb-claim0-persistentvolumeclaim.yaml" created
INFO Kubernetes file "redis-master-deployment.yaml" created
INFO Kubernetes file "redis-slave-deployment.yaml" created
$ ls
mlbparks-deployment.yaml mongodb-service.yaml redis-slave-service.jsonmlbparks-service.yaml
frontend-deployment.yaml mongodb-claim0-persistentvolumeclaim.yaml redis-master-service.yaml
frontend-service.yaml mongodb-deployment.yaml redis-slave-deployment.yaml
redis-master-deployment.yaml
```
<!--
When multiple docker-compose files are provided the configuration is merged. Any configuration that is common will be over ridden by subsequent file.
-->
当提供多个 docker-compose 文件时,配置将会合并。任何通用的配置都将被后续文件覆盖。
### OpenShift
```sh
$ kompose --provider openshift --file docker-voting.yml convert
WARN [worker] Service cannot be created because of missing port.
INFO OpenShift file "vote-service.yaml" created
INFO OpenShift file "db-service.yaml" created
INFO OpenShift file "redis-service.yaml" created
INFO OpenShift file "result-service.yaml" created
INFO OpenShift file "vote-deploymentconfig.yaml" created
INFO OpenShift file "vote-imagestream.yaml" created
INFO OpenShift file "worker-deploymentconfig.yaml" created
INFO OpenShift file "worker-imagestream.yaml" created
INFO OpenShift file "db-deploymentconfig.yaml" created
INFO OpenShift file "db-imagestream.yaml" created
INFO OpenShift file "redis-deploymentconfig.yaml" created
INFO OpenShift file "redis-imagestream.yaml" created
INFO OpenShift file "result-deploymentconfig.yaml" created
INFO OpenShift file "result-imagestream.yaml" created
```
<!--
It also supports creating buildconfig for build directive in a service. By default, it uses the remote repo for the current git branch as the source repo, and the current branch as the source branch for the build. You can specify a different source repo and branch using ``--build-repo`` and ``--build-branch`` options respectively.
-->
kompose 还支持为服务中的构建指令创建 buildconfig。
默认情况下,它使用当前 git 分支的 remote 仓库作为源仓库,使用当前分支作为构建的源分支。
您可以分别使用 ``--build-repo`` 和 ``--build-branch`` 选项指定不同的源仓库和分支。
```sh
$ kompose --provider openshift --file buildconfig/docker-compose.yml convert
WARN [foo] Service cannot be created because of missing port.
INFO OpenShift Buildconfig using git@github.com:rtnpro/kompose.git::master as source.
INFO OpenShift file "foo-deploymentconfig.yaml" created
INFO OpenShift file "foo-imagestream.yaml" created
INFO OpenShift file "foo-buildconfig.yaml" created
```
{{< note >}}
<!--
If you are manually pushing the Openshift artifacts using ``oc create -f``, you need to ensure that you push the imagestream artifact before the buildconfig artifact, to workaround this Openshift issue: https://github.com/openshift/origin/issues/4518 .
-->
如果使用 ``oc create -f`` 手动推送 Openshift 工件,则需要确保在构建配置工件之前推送 imagestream 工件,以解决 Openshift 的这个问题:https://github.com/openshift/origin/issues/4518 。
{{< /note >}}
## `kompose up`
<!--
Kompose supports a straightforward way to deploy your "composed" application to Kubernetes or OpenShift via `kompose up`.
-->
Kompose 支持通过 `kompose up` 直接将您的"复合的(composed" 应用程序部署到 Kubernetes 或 OpenShift。
### Kubernetes
```sh
$ kompose --file ./examples/docker-guestbook.yml up
We are going to create Kubernetes deployments and services for your Dockerized application.
If you need different kind of resources, use the 'kompose convert' and 'kubectl create -f' commands instead.
INFO Successfully created service: redis-master
INFO Successfully created service: redis-slave
INFO Successfully created service: frontend
INFO Successfully created deployment: redis-master
INFO Successfully created deployment: redis-slave
INFO Successfully created deployment: frontend
Your application has been deployed to Kubernetes. You can run 'kubectl get deployment,svc,pods' for details.
$ kubectl get deployment,svc,pods
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
deployment.extensions/frontend 1 1 1 1 4m
deployment.extensions/redis-master 1 1 1 1 4m
deployment.extensions/redis-slave 1 1 1 1 4m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/frontend ClusterIP 10.0.174.12 <none> 80/TCP 4m
service/kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 13d
service/redis-master ClusterIP 10.0.202.43 <none> 6379/TCP 4m
service/redis-slave ClusterIP 10.0.1.85 <none> 6379/TCP 4m
NAME READY STATUS RESTARTS AGE
pod/frontend-2768218532-cs5t5 1/1 Running 0 4m
pod/redis-master-1432129712-63jn8 1/1 Running 0 4m
pod/redis-slave-2504961300-nve7b 1/1 Running 0 4m
```
<!--
**Note**:
- You must have a running Kubernetes cluster with a pre-configured kubectl context.
- Only deployments and services are generated and deployed to Kubernetes. If you need different kind of resources, use the `kompose convert` and `kubectl create -f` commands instead.
-->
**注意**
- 您必须有一个运行正常的 Kubernetes 集群,该集群具有预先配置的 kubectl 上下文。
- 此操作仅生成 Deployment 和 Service 对象并将其部署到 Kubernetes。如果需要部署其他不同类型的资源,请使用 `kompose convert` 和 `kubectl create -f` 命令。
### OpenShift
```sh
$ kompose --file ./examples/docker-guestbook.yml --provider openshift up
We are going to create OpenShift DeploymentConfigs and Services for your Dockerized application.
If you need different kind of resources, use the 'kompose convert' and 'oc create -f' commands instead.
INFO Successfully created service: redis-slave
INFO Successfully created service: frontend
INFO Successfully created service: redis-master
INFO Successfully created deployment: redis-slave
INFO Successfully created ImageStream: redis-slave
INFO Successfully created deployment: frontend
INFO Successfully created ImageStream: frontend
INFO Successfully created deployment: redis-master
INFO Successfully created ImageStream: redis-master
Your application has been deployed to OpenShift. You can run 'oc get dc,svc,is' for details.
$ oc get dc,svc,is
NAME REVISION DESIRED CURRENT TRIGGERED BY
dc/frontend 0 1 0 config,image(frontend:v4)
dc/redis-master 0 1 0 config,image(redis-master:e2e)
dc/redis-slave 0 1 0 config,image(redis-slave:v1)
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
svc/frontend 172.30.46.64 <none> 80/TCP 8s
svc/redis-master 172.30.144.56 <none> 6379/TCP 8s
svc/redis-slave 172.30.75.245 <none> 6379/TCP 8s
NAME DOCKER REPO TAGS UPDATED
is/frontend 172.30.12.200:5000/fff/frontend
is/redis-master 172.30.12.200:5000/fff/redis-master
is/redis-slave 172.30.12.200:5000/fff/redis-slave v1
```
<!--
**Note**:
- You must have a running OpenShift cluster with a pre-configured `oc` context (`oc login`)
-->
**注意**
- 您必须有一个运行正常的 OpenShift 集群,该集群具有预先配置的 `oc` 上下文 (`oc login`)。
## `kompose down`
<!--
Once you have deployed "composed" application to Kubernetes, `$ kompose down` will help you to take the application out by deleting its deployments and services. If you need to remove other resources, use the 'kubectl' command.
-->
您一旦将"复合(composed)" 应用部署到 Kubernetes`$ kompose down` 命令将能帮您通过删除 Deployment 和 Service 对象来删除应用。如果需要删除其他资源,请使用 'kubectl' 命令。
```sh
$ kompose --file docker-guestbook.yml down
INFO Successfully deleted service: redis-master
INFO Successfully deleted deployment: redis-master
INFO Successfully deleted service: redis-slave
INFO Successfully deleted deployment: redis-slave
INFO Successfully deleted service: frontend
INFO Successfully deleted deployment: frontend
```
<!--
**Note**:
- You must have a running Kubernetes cluster with a pre-configured kubectl context.
## Build and Push Docker Images
Kompose supports both building and pushing Docker images. When using the `build` key within your Docker Compose file, your image will:
- Automatically be built with Docker using the `image` key specified within your file
- Be pushed to the correct Docker repository using local credentials (located at `.docker/config`)
Using an [example Docker Compose file](https://raw.githubusercontent.com/kubernetes/kompose/master/examples/buildconfig/docker-compose.yml):
-->
**注意**
- 您必须有一个运行正常的 Kubernetes 集群,该集群具有预先配置的 kubectl 上下文。
## 构建和推送 Docker 镜像
Kompose 支持构建和推送 Docker 镜像。如果 Docker Compose 文件中使用了 `build` 关键字,您的镜像将会:
- 使用文档中指定的 `image` 键自动构建 Docker 镜像
- 使用本地凭据推送到正确的 Docker 仓库
使用 [Docker Compose 文件示例](https://raw.githubusercontent.com/kubernetes/kompose/master/examples/buildconfig/docker-compose.yml)
```yaml
version: "2"
services:
foo:
build: "./build"
image: docker.io/foo/bar
```
<!--
Using `kompose up` with a `build` key:
-->
使用带有 `build` 键的 `kompose up` 命令:
```none
$ kompose up
INFO Build key detected. Attempting to build and push image 'docker.io/foo/bar'
INFO Building image 'docker.io/foo/bar' from directory 'build'
INFO Image 'docker.io/foo/bar' from directory 'build' built successfully
INFO Pushing image 'foo/bar:latest' to registry 'docker.io'
INFO Attempting authentication credentials 'https://index.docker.io/v1/
INFO Successfully pushed image 'foo/bar:latest' to registry 'docker.io'
INFO We are going to create Kubernetes Deployments, Services and PersistentVolumeClaims for your Dockerized application. If you need different kind of resources, use the 'kompose convert' and 'kubectl create -f' commands instead.
INFO Deploying application in "default" namespace
INFO Successfully created Service: foo
INFO Successfully created Deployment: foo
Your application has been deployed to Kubernetes. You can run 'kubectl get deployment,svc,pods,pvc' for details.
```
<!--
In order to disable the functionality, or choose to use BuildConfig generation (with OpenShift) `--build (local|build-config|none)` can be passed.
-->
要想禁用该功能,或者使用 BuildConfig 中的版本(在 OpenShift 中),可以通过传递 `--build (local|build-config|none)` 参数来实现。
```sh
# Disable building/pushing Docker images
$ kompose up --build none
# Generate Build Config artifacts for OpenShift
$ kompose up --provider openshift --build build-config
```
<!--
## Alternative Conversions
The default `kompose` transformation will generate Kubernetes [Deployments](/docs/concepts/workloads/controllers/deployment/) and [Services](/docs/concepts/services-networking/service/), in yaml format. You have alternative option to generate json with `-j`. Also, you can alternatively generate [Replication Controllers](/docs/concepts/workloads/controllers/replicationcontroller/) objects, [Daemon Sets](/docs/concepts/workloads/controllers/daemonset/), or [Helm](https://github.com/helm/helm) charts.
-->
## 其他转换方式
默认的 `kompose` 转换会生成 yaml 格式的 Kubernetes [Deployment](/docs/concepts/workloads/controllers/deployment/) 和 [Service](/docs/concepts/services-networking/service/) 对象。
您可以选择通过 `-j` 参数生成 json 格式的对象。
您也可以替换生成 [Replication Controllers](/docs/concepts/workloads/controllers/replicationcontroller/) 对象、[Daemon Sets](/docs/concepts/workloads/controllers/daemonset/) 或 [Helm](https://github.com/helm/helm) charts。
```sh
$ kompose convert -j
INFO Kubernetes file "redis-svc.json" created
INFO Kubernetes file "web-svc.json" created
INFO Kubernetes file "redis-deployment.json" created
INFO Kubernetes file "web-deployment.json" created
```
<!--
The `*-deployment.json` files contain the Deployment objects.
-->
`*-deployment.json` 文件中包含 Deployment 对象。
```sh
$ kompose convert --replication-controller
INFO Kubernetes file "redis-svc.yaml" created
INFO Kubernetes file "web-svc.yaml" created
INFO Kubernetes file "redis-replicationcontroller.yaml" created
INFO Kubernetes file "web-replicationcontroller.yaml" created
```
<!--
The `*-replicationcontroller.yaml` files contain the Replication Controller objects. If you want to specify replicas (default is 1), use `--replicas` flag: `$ kompose convert --replication-controller --replicas 3`
-->
`*-replicationcontroller.yaml` 文件包含 Replication Controller 对象。如果您想指定副本数(默认为 1),可以使用 `--replicas` 参数:`$ kompose convert --replication-controller --replicas 3`
```sh
$ kompose convert --daemon-set
INFO Kubernetes file "redis-svc.yaml" created
INFO Kubernetes file "web-svc.yaml" created
INFO Kubernetes file "redis-daemonset.yaml" created
INFO Kubernetes file "web-daemonset.yaml" created
```
<!--
The `*-daemonset.yaml` files contain the Daemon Set objects
If you want to generate a Chart to be used with [Helm](https://github.com/kubernetes/helm) simply do:
-->
`*-daemonset.yaml` 文件包含 Daemon Set 对象。
如果您想生成 [Helm](https://github.com/kubernetes/helm) 可用的 Chart,只需简单的执行下面的命令:
```sh
$ kompose convert -c
INFO Kubernetes file "web-svc.yaml" created
INFO Kubernetes file "redis-svc.yaml" created
INFO Kubernetes file "web-deployment.yaml" created
INFO Kubernetes file "redis-deployment.yaml" created
chart created in "./docker-compose/"
$ tree docker-compose/
docker-compose
├── Chart.yaml
├── README.md
└── templates
├── redis-deployment.yaml
├── redis-svc.yaml
├── web-deployment.yaml
└── web-svc.yaml
```
<!--
The chart structure is aimed at providing a skeleton for building your Helm charts.
## Labels
`kompose` supports Kompose-specific labels within the `docker-compose.yml` file in order to explicitly define a service's behavior upon conversion.
- `kompose.service.type` defines the type of service to be created.
For example:
-->
这个图标结构旨在为构建 Helm Chart 提供框架。
## 标签
`kompose` 支持 `docker-compose.yml` 文件中用于 Kompose 的标签,以便在转换时明确定义 Service 的行为。
- `kompose.service.type` 定义要创建的 Service 类型。
```yaml
version: "2"
services:
nginx:
image: nginx
dockerfile: foobar
build: ./foobar
cap_add:
- ALL
container_name: foobar
labels:
kompose.service.type: nodeport
```
<!--
- `kompose.service.expose` defines if the service needs to be made accessible from outside the cluster or not. If the value is set to "true", the provider sets the endpoint automatically, and for any other value, the value is set as the hostname. If multiple ports are defined in a service, the first one is chosen to be the exposed.
- For the Kubernetes provider, an ingress resource is created and it is assumed that an ingress controller has already been configured.
- For the OpenShift provider, a route is created.
For example:
-->
- `kompose.service.expose` 定义 是否允许从集群外部访问 Service。如果该值被设置为 "true",提供程序将自动设置端点,对于任何其他值,该值将被设置为主机名。如果在 Service 中定义了多个端口,则选择第一个端口作为公开端口。
- 对于 Kubernetes 驱动程序,创建了一个 Ingress 资源,并且假定已经配置了相应的 Ingress 控制器。
- 对于 OpenShift 驱动程序, 创建一个 route。
例如:
```yaml
version: "2"
services:
web:
image: tuna/docker-counter23
ports:
- "5000:5000"
links:
- redis
labels:
kompose.service.expose: "counter.example.com"
redis:
image: redis:3.0
ports:
- "6379"
```
<!--
The currently supported options are:
| Key | Value |
|----------------------|-------------------------------------|
| kompose.service.type | nodeport / clusterip / loadbalancer |
| kompose.service.expose| true / hostname |
-->
当前支持的选项有:
| 键 | 值 |
|----------------------|-------------------------------------|
| kompose.service.type | nodeport / clusterip / loadbalancer |
| kompose.service.expose| true / hostname |
{{< note >}}
<!--
The `kompose.service.type` label should be defined with `ports` only, otherwise `kompose` will fail.
-->
`kompose.service.type` 标签应该只用`ports`来定义,否则 `kompose` 会失败。
{{< /note >}}
<!--
## Restart
If you want to create normal pods without controllers you can use `restart` construct of docker-compose to define that. Follow table below to see what happens on the `restart` value.
-->
## 重启
如果你想创建没有控制器的普通 Pod,可以使用 docker-compose 的 `restart` 结构来定义它。请参考下表了解 `restart` 的不同参数。
<!--
| `docker-compose` `restart` | object created | Pod `restartPolicy` |
|----------------------------|-------------------|---------------------|
| `""` | controller object | `Always` |
| `always` | controller object | `Always` |
| `on-failure` | Pod | `OnFailure` |
| `no` | Pod | `Never` |
-->
| `docker-compose` `restart` | 创建的对象 | Pod `restartPolicy` |
|----------------------------|-------------------|---------------------|
| `""` | 控制器对象 | `Always` |
| `always` | 控制器对象 | `Always` |
| `on-failure` | Pod | `OnFailure` |
| `no` | Pod | `Never` |
{{< note >}}
<!--
The controller object could be `deployment` or `replicationcontroller`, etc.
-->
控制器对象可以是 `deployment` 或 `replicationcontroller` 等。
{{< /note >}}
<!--
For e.g. `pival` service will become pod down here. This container calculated value of `pi`.
-->
例如,`pival` Service 将在这里变成 Pod。这个容器的计算值为 `pi`。
```yaml
version: '2'
services:
pival:
image: perl
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
restart: "on-failure"
```
<!--
### Warning about Deployment Config's
If the Docker Compose file has a volume specified for a service, the Deployment (Kubernetes) or DeploymentConfig (OpenShift) strategy is changed to "Recreate" instead of "RollingUpdate" (default). This is done to avoid multiple instances of a service from accessing a volume at the same time.
-->
### 关于 Deployment Config 的提醒
如果 Docker Compose 文件中为服务声明了卷,Deployment (Kubernetes) 或 DeploymentConfig (OpenShift) 的策略会从 "RollingUpdate" (默认) 变为 "Recreate"。
这样做的目的是为了避免服务的多个实例同时访问卷。
<!--
If the Docker Compose file has service name with `_` in it (eg.`web_service`), then it will be replaced by `-` and the service name will be renamed accordingly (eg.`web-service`). Kompose does this because "Kubernetes" doesn't allow `_` in object name.
Please note that changing service name might break some `docker-compose` files.
-->
如果 Docker Compose 文件中的服务名包含 `_` (例如 `web_service`),那么将会被替换为 `-`,服务也相应的会重命名(例如 `web-service`)。
Kompose 这样做的原因是 "Kubernetes" 不允许对象名称中包含 `_`。
<!--
## Docker Compose Versions
Kompose supports Docker Compose versions: 1, 2 and 3. We have limited support on versions 2.1 and 3.2 due to their experimental nature.
A full list on compatibility between all three versions is listed in our [conversion document](https://github.com/kubernetes/kompose/blob/master/docs/conversion.md) including a list of all incompatible Docker Compose keys.
-->
## Docker Compose 版本
Kompose 支持的 Docker Compose 版本包括:1、2 和 3。有限支持 2.1 和 3.2 版本,因为它们还在实验阶段。
所有三个版本的兼容性列表请查看我们的 [转换文档](https://github.com/kubernetes/kompose/blob/master/docs/conversion.md),文档中列出了所有不兼容的 Docker Compose 关键字。
{{% /capture %}}