Merge pull request #27956 from CaoDonghui123/fix2

[zh]Resync tasks files[11]
This commit is contained in:
Kubernetes Prow Robot 2021-05-13 22:06:05 -07:00 committed by GitHub
commit 6b7072e507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 104 additions and 75 deletions

View File

@ -183,6 +183,8 @@ kubectl get secret mysecret -o yaml
```yaml
apiVersion: v1
data:
config.yaml: YXBpVXJsOiAiaHR0cHM6Ly9teS5hcGkuY29tL2FwaS92MSIKdXNlcm5hbWU6IHt7dXNlcm5hbWV9fQpwYXNzd29yZDoge3twYXNzd29yZH19
kind: Secret
metadata:
creationTimestamp: 2018-11-15T20:40:59Z
@ -191,8 +193,6 @@ metadata:
resourceVersion: "7225"
uid: c280ad2e-e916-11e8-98f2-025000000001
type: Opaque
data:
config.yaml: YXBpVXJsOiAiaHR0cHM6Ly9teS5hcGkuY29tL2FwaS92MSIKdXNlcm5hbWU6IHt7dXNlcm5hbWV9fQpwYXNzd29yZDoge3twYXNzd29yZH19
```
<!--
@ -230,6 +230,8 @@ stringData:
```yaml
apiVersion: v1
data:
username: YWRtaW5pc3RyYXRvcg==
kind: Secret
metadata:
creationTimestamp: 2018-11-15T20:46:46Z
@ -238,8 +240,6 @@ metadata:
resourceVersion: "7579"
uid: 91460ecb-e917-11e8-98f2-025000000001
type: Opaque
data:
username: YWRtaW5pc3RyYXRvcg==
```
<!-- Where `YWRtaW5pc3RyYXRvcg==` decodes to `administrator`. -->
@ -248,8 +248,8 @@ data:
<!-- ## Clean Up -->
## 清理 {#clean-up}
<!-- To delete the Secret you have just created: -->
删除你刚才创建的 Secret
<!-- To delete the Secret you have created: -->
删除你创建的 Secret
```shell
kubectl delete secret mysecret
@ -260,7 +260,7 @@ kubectl delete secret mysecret
<!--
- Read more about the [Secret concept](/docs/concepts/configuration/secret/)
- Learn how to [manage Secret with the `kubectl` command](/docs/tasks/configmap-secret/managing-secret-using-kubectl/)
- Learn how to [manage Secret using kustomizae](/docs/tasks/configmap-secret/managing-secret-using-kustomize/)
- Learn how to [manage Secret using kustomize](/docs/tasks/configmap-secret/managing-secret-using-kustomize/)
-->
- 进一步阅读 [Secret 概念](/zh/docs/concepts/configuration/secret/)
- 了解如何[使用 `kubectl` 命令管理 Secret](/zh/docs/tasks/configmap-secret/managing-secret-using-kubectl/)

View File

@ -5,7 +5,7 @@ weight: 10
description: 使用 kubectl 命令行创建 Secret 对象。
---
<!--
title: Managing Secret using kubectl
title: Managing Secrets using kubectl
content_type: task
weight: 10
description: Creating Secret objects using kubectl command line.
@ -23,7 +23,7 @@ description: Creating Secret objects using kubectl command line.
## 创建 Secret {#create-a-secret}
<!--
A `Secret` can contain user credentials required by Pods to access a database.
A `Secret` can contain user credentials required by pods to access a database.
For example, a database connection string consists of a username and password.
You can store the username in a file `./username.txt` and the password in a
file `./password.txt` on your local machine.
@ -38,12 +38,12 @@ echo -n '1f2d1e2e67df' > ./password.txt
```
<!--
The `-n` flag in the above two commands ensures that the generated files will
not contain an extra newline character at the end of the text. This is
important because when `kubectl` reads a file and encode the content into
base64 string, the extra newline character gets encoded too.
In these commands, the `-n` flag ensures that the generated files do not have
an extra newline character at the end of the text. This is important because
when `kubectl` reads a file and encodes the content into a base64 string, the
extra newline character gets encoded too.
-->
上面两个命令中的 `-n` 标志确保生成的文件在文本末尾不包含额外的换行符。
在这些命令中,`-n` 标志确保生成的文件在文本末尾不包含额外的换行符。
这一点很重要,因为当 `kubectl` 读取文件并将内容编码为 base64 字符串时,多余的换行符也会被编码。
<!--
@ -66,7 +66,7 @@ secret/db-user-pass created
```
<!--
Default key name is the filename. You may optionally set the key name using
The default key name is the filename. You can optionally set the key name using
`--from-file=[key=]source`. For example:
-->
默认密钥名称是文件名。 你可以选择使用 `--from-file=[key=]source` 来设置密钥名称。例如:
@ -78,10 +78,10 @@ kubectl create secret generic db-user-pass \
```
<!--
You do not need to escape special characters in passwords from files
().
You do not need to escape special characters in password strings that you
include in a file.
-->
无需转义文件(`--from-file`)中的密码的特殊字符
不需要对文件中包含的密码字符串中的特殊字符进行转义
<!--
You can also provide Secret data using the `--from-literal=<key>=<value>` tag.
@ -89,13 +89,16 @@ This tag can be specified more than once to provide multiple key-value pairs.
Note that special characters such as `$`, `\`, `*`, `=`, and `!` will be
interpreted by your [shell](https://en.wikipedia.org/wiki/Shell_(computing))
and require escaping.
In most shells, the easiest way to escape the password is to surround it with
single quotes (`'`). For example, if your actual password is `S!B\*d$zDsb=`,
you should execute the command this way:
single quotes (`'`). For example, if your password is `S!B\*d$zDsb=`,
run the following command:
-->
你还可以使用 `--from-literal=<key>=<value>` 标签提供 Secret 数据。
可以多次使用此标签,提供多个键值对。
请注意,特殊字符(例如:`$``\``*``=` 和 `!`)由你的 [shell](https://en.wikipedia.org/wiki/Shell_(computing)) 解释执行,而且需要转义。
请注意,特殊字符(例如:`$``\``*``=` 和 `!`)由你的 [shell](https://en.wikipedia.org/wiki/Shell_(computing))
解释执行,而且需要转义。
在大多数 shell 中,转义密码最简便的方法是用单引号括起来。
比如,如果你的密码是 `S!B\*d$zDsb=`
可以像下面一样执行命令:
@ -109,8 +112,8 @@ kubectl create secret generic dev-db-secret \
<!-- ## Verify the Secret -->
## 验证 Secret {#verify-the-secret}
<!-- You can check that the secret was created: -->
你可以检查 secret 是否已创建:
<!-- Check that the Secret was created: -->
检查 secret 是否已创建:
```shell
kubectl get secrets
@ -151,19 +154,18 @@ username: 5 bytes
<!--
The commands `kubectl get` and `kubectl describe` avoid showing the contents
of a `Secret` by default. This is to protect the `Secret` from being exposed
accidentally to an onlooker, or from being stored in a terminal log.
accidentally, or from being stored in a terminal log.
-->
`kubectl get``kubectl describe` 命令默认不显示 `Secret` 的内容。
这是为了防止 `Secret` 被意外暴露给旁观者或存储在终端日志中。
这是为了防止 `Secret` 被意外暴露或存储在终端日志中。
<!-- ## Decoding the Secret {#decoding-secret} -->
## 解码 Secret {#decoding-secret}
<!--
To view the contents of the Secret we just created, you can run the following
command:
To view the contents of the Secret you created, run the following command:
-->
要查看我们刚刚创建的 Secret 的内容,可以运行以下命令:
要查看创建的 Secret 的内容,运行以下命令:
```shell
kubectl get secret db-user-pass -o jsonpath='{.data}'
@ -195,8 +197,8 @@ echo 'MWYyZDFlMmU2N2Rm' | base64 --decode
<!-- ## Clean Up -->
## 清理 {#clean-up}
<!-- To delete the Secret you have just created: -->
删除刚刚创建的 Secret
<!-- Delete the Secret you created: -->
删除创建的 Secret
```shell
kubectl delete secret db-user-pass
@ -208,8 +210,8 @@ kubectl delete secret db-user-pass
<!--
- Read more about the [Secret concept](/docs/concepts/configuration/secret/)
- Learn how to [manage Secret using config file](/docs/tasks/configmap-secret/managing-secret-using-config-file/)
- Learn how to [manage Secret using kustomize](/docs/tasks/configmap-secret/managing-secret-using-kustomize/)
- Learn how to [manage Secrets using config files](/docs/tasks/configmap-secret/managing-secret-using-config-file/)
- Learn how to [manage Secrets using kustomize](/docs/tasks/configmap-secret/managing-secret-using-kustomize/)
-->
- 进一步阅读 [Secret 概念](/zh/docs/concepts/configuration/secret/)
- 了解如何[使用配置文件管理 Secret](/zh/docs/tasks/configmap-secret/managing-secret-using-config-file/)

View File

@ -125,7 +125,7 @@ kubectl describe secrets/db-user-pass-96mffmfh4k
输出类似于:
```
Name: db-user-pass
Name: db-user-pass-96mffmfh4k
Namespace: default
Labels: <none>
Annotations: <none>
@ -154,8 +154,8 @@ To check the actual content of the encoded data, please refer to
<!-- ## Clean Up -->
## 清理 {#clean-up}
<!-- To delete the Secret you have just created: -->
删除你刚才创建的 Secret
<!-- To delete the Secret you have created: -->
删除你创建的 Secret
```shell
kubectl delete secret db-user-pass-96mffmfh4k

View File

@ -39,18 +39,18 @@ that run in the Pod. To set environment variables, include the `env` or
<!--
In this exercise, you create a Pod that runs one container. The configuration
file for the Pod defines an environment variable with name `DEMO_GREETING` and
value `"Hello from the environment"`. Here is the configuration file for the
value `"Hello from the environment"`. Here is the configuration manifest for the
Pod:
-->
本示例中,将创建一个只包含单个容器的 Pod。Pod 的配置文件中设置环境变量的名称为 `DEMO_GREETING`
其值为 `"Hello from the environment"`。下面是 Pod 的配置文件内容
其值为 `"Hello from the environment"`。下面是 Pod 的配置清单
{{< codenew file="pods/inject/envars.yaml" >}}
<!--
1. Create a Pod based on the YAML configuration file:
1. Create a Pod based on that manifest:
-->
1. 基于 YAML 文件创建一个 Pod
1. 基于配置清单创建一个 Pod
```shell
kubectl apply -f https://k8s.io/examples/pods/inject/envars.yaml
@ -59,7 +59,7 @@ Pod:
<!--
1. List the running Pods:
-->
1. 获取一下当前正在运行的 Pods 信息:
2. 获取一下当前正在运行的 Pods 信息:
```shell
kubectl get pods -l purpose=demonstrate-envars
@ -69,8 +69,8 @@ Pod:
The output is similar to this:
-->
查询结果应为:
```shell
```
NAME READY STATUS RESTARTS AGE
envar-demo 1/1 Running 0 9s
```
@ -78,8 +78,8 @@ Pod:
<!--
1. List the Pod's container environment variables:
-->
1. 列出 Pod 容器的环境变量:
3. 列出 Pod 容器的环境变量:
```shell
kubectl exec envar-demo -- printenv
```
@ -88,8 +88,8 @@ Pod:
The output is similar to this:
-->
打印结果应为:
```shell
```
NODE_VERSION=4.4.2
EXAMPLE_SERVICE_PORT_8080_TCP_ADDR=10.3.245.237
HOSTNAME=envar-demo
@ -101,25 +101,44 @@ Pod:
<!--
{{< note >}}
The environment variables set using the `env` or `envFrom` field
will override any environment variables specified in the container image.
override any environment variables specified in the container image.
{{< /note >}}
-->
{{< note >}}
通过 `env``envFrom` 字段设置的环境变量将覆盖容器镜像中指定的所有环境变量。
{{< /note >}}
<!--
{{< note >}}
环境变量之间可能出现互相依赖或者循环引用的情况,使用之前需注意引用顺序
Environment variables may reference each other, however ordering is important.
Variables making use of others defined in the same context must come later in
the list. Similarly, avoid circular references.
{{< /note >}}
-->
{{< note >}}
环境变量可以互相引用,但是顺序很重要。
使用在相同上下文中定义的其他变量的变量必须在列表的后面。
同样,请避免使用循环引用。
{{< /note >}}
<!--
## Using environment variables inside of your config
Environment variables that you define in a Pod's configuration can be used elsewhere in the configuration, for example in commands and arguments that you set for the Pod's containers. In the example configuration below, the `GREETING`, `HONORIFIC`, and `NAME` environment variables are set to `Warm greetings to`, `The Most Honorable`, and `Kubernetes`, respectively. Those environment variables are then used in the CLI arguments passed to the `env-print-demo` container.
Environment variables that you define in a Pod's configuration can be used
elsewhere in the configuration, for example in commands and arguments that
you set for the Pod's containers.
In the example configuration below, the `GREETING`, `HONORIFIC`, and
`NAME` environment variables are set to `Warm greetings to`, `The Most
Honorable`, and `Kubernetes`, respectively. Those environment variables
are then used in the CLI arguments passed to the `env-print-demo`
container.
-->
## 在配置中使用环境变量
您在 Pod 的配置中定义的环境变量可以在配置的其他地方使用,例如可用在为 Pod 的容器设置的命令和参数中。在下面的示例配置中,环境变量 `GREETING` `HONORIFIC` 和 `NAME` 分别设置为 `Warm greetings to` `The Most Honorable` 和 `Kubernetes`。然后这些环境变量在传递给容器 `env-print-demo` 的 CLI 参数中使用。
您在 Pod 的配置中定义的环境变量可以在配置的其他地方使用,
例如可用在为 Pod 的容器设置的命令和参数中。
在下面的示例配置中,环境变量 `GREETING` `HONORIFIC` 和 `NAME` 分别设置为 `Warm greetings to`
`The Most Honorable``Kubernetes`。然后这些环境变量在传递给容器 `env-print-demo` 的 CLI 参数中使用。
```yaml
apiVersion: v1

View File

@ -38,7 +38,7 @@ You should already know how to [perform a rolling update on a
### Step 1: Find the DaemonSet revision you want to roll back to
You can skip this step if you just want to roll back to the last revision.
You can skip this step if you only want to roll back to the last revision.
List all revisions of a DaemonSet:
-->

View File

@ -191,7 +191,7 @@ kubectl edit ds/fluentd-elasticsearch -n kube-system
<!--
##### Updating only the container image
If you just need to update the container image in the DaemonSet template, i.e.
If you only need to update the container image in the DaemonSet template, i.e.
`.spec.template.spec.containers[*].image`, use `kubectl set image`:
--->
##### 只更新容器镜像
@ -295,10 +295,10 @@ DaemonSet rollout won't progress.
(通常由于拼写错误),就会发生 DaemonSet 滚动更新中断。
<!--
To fix this, just update the DaemonSet template again. New rollout won't be
To fix this, update the DaemonSet template again. New rollout won't be
blocked by previous unhealthy rollouts.
-->
要解决此问题,需再次更新 DaemonSet 模板即可。以前不健康的滚动更新不会阻止新的滚动更新
要解决此问题,需再次更新 DaemonSet 模板。新的滚动更新不会被以前不健康的滚动更新阻止。
<!--
#### Clock skew

View File

@ -26,9 +26,9 @@ preview of what changes `apply` will make.
## {{% heading "prerequisites" %}}
<!--
Install [`kubectl`](/docs/tasks/tools/install-kubectl/).
Install [`kubectl`](/docs/tasks/tools/).
-->
安装 [`kubectl`](/zh/docs/tasks/tools/install-kubectl/)。
安装 [`kubectl`](/zh/docs/tasks/tools/)。
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}

View File

@ -21,9 +21,9 @@ Kubernetes 对象。本文档解释这些命令的组织方式以及如何使用
## {{% heading "prerequisites" %}}
<!--
Install [`kubectl`](/docs/tasks/tools/install-kubectl/).
Install [`kubectl`](/docs/tasks/tools/).
-->
安装[`kubectl`](/zh/docs/tasks/tools/install-kubectl/)。
安装[`kubectl`](/zh/docs/tasks/tools/)。
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}

View File

@ -21,9 +21,9 @@ This document explains how to define and manage objects using configuration file
## {{% heading "prerequisites" %}}
<!--
Install [`kubectl`](/docs/tasks/tools/install-kubectl/).
Install [`kubectl`](/docs/tasks/tools/).
-->
安装 [`kubectl`](/zh/docs/tasks/tools/install-kubectl/) 。
安装 [`kubectl`](/zh/docs/tasks/tools/) 。
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}

View File

@ -27,7 +27,7 @@ Use [Helm](https://helm.sh/) to install Service Catalog on your Kubernetes clust
* You must have a Kubernetes cluster with cluster DNS enabled.
* If you are using a cloud-based Kubernetes cluster or {{< glossary_tooltip text="Minikube" term_id="minikube" >}}, you may already have cluster DNS enabled.
* If you are using `hack/local-up-cluster.sh`, ensure that the `KUBE_ENABLE_CLUSTER_DNS` environment variable is set, then run the install script.
* [Install and setup kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) v1.7 or higher. Make sure it is configured to connect to the Kubernetes cluster.
* [Install and setup kubectl](/docs/tasks/tools/) v1.7 or higher. Make sure it is configured to connect to the Kubernetes cluster.
* Install [Helm](http://helm.sh/) v2.7.0 or newer.
* Follow the [Helm install instructions](https://github.com/kubernetes/helm/blob/master/docs/install.md).
* If you already have an appropriate version of Helm installed, execute `helm init` to install Tiller, the server-side component of Helm.
@ -37,7 +37,7 @@ Use [Helm](https://helm.sh/) to install Service Catalog on your Kubernetes clust
* 你必须启用 Kubernetes 集群的 DNS 功能。
* 如果使用基于云的 Kubernetes 集群或 {{< glossary_tooltip text="Minikube" term_id="minikube" >}},则可能已经启用了集群 DNS。
* 如果你正在使用 `hack/local-up-cluster.sh`,请确保设置了 `KUBE_ENABLE_CLUSTER_DNS` 环境变量,然后运行安装脚本。
* [安装和设置 v1.7 或更高版本的 kubectl](/zh/docs/tasks/tools/install-kubectl/),确保将其配置为连接到 Kubernetes 集群。
* [安装和设置 v1.7 或更高版本的 kubectl](/zh/docs/tasks/tools/),确保将其配置为连接到 Kubernetes 集群。
* 安装 v2.7.0 或更高版本的 [Helm](https://helm.sh/)。
* 遵照 [Helm 安装说明](https://helm.sh/docs/intro/install/)。
* 如果已经安装了适当版本的 Helm请执行 `helm init` 来安装 Helm 的服务器端组件 Tiller。
@ -53,7 +53,7 @@ Once Helm is installed, add the *service-catalog* Helm repository to your local
安装 Helm 后,通过执行以下命令将 *service-catalog* Helm 存储库添加到本地计算机:
```shell
helm repo add svc-cat https://svc-catalog-charts.storage.googleapis.com
helm repo add svc-cat https://kubernetes-sigs.github.io/service-catalog
```
<!--

View File

@ -16,12 +16,16 @@ content_type: task
{{< glossary_definition term_id="service-catalog" length="all" prepend="服务目录Service Catalog是" >}}
<!--
Use the [Service Catalog Installer](https://github.com/GoogleCloudPlatform/k8s-service-catalog#installation) tool to easily install or uninstall Service Catalog on your Kubernetes cluster. This CLI tool is installed as `sc` in your local environment.
-->
使用[服务目录安装程序](https://github.com/GoogleCloudPlatform/k8s-service-catalog#installation)
工具可以轻松地在 Kubernetes 集群上安装或卸载服务目录。
这个 CLI 工具以 `sc` 命令形式被安装在您的本地环境中。
You can use the GCP [Service Catalog Installer](https://github.com/GoogleCloudPlatform/k8s-service-catalog#installation)
tool to easily install or uninstall Service Catalog on your Kubernetes cluster, linking it to
Google Cloud projects.
Service Catalog can work with any kind of managed service, not only Google Cloud.
-->
使用 GCP [服务目录安装程序](https://github.com/GoogleCloudPlatform/k8s-service-catalog#installation)
工具可以轻松地在 Kubernetes 集群上安装或卸载服务目录,并将其链接到 Google Cloud 项目。
服务目录不仅可以与 Google Cloud 一起使用,还可以与任何类型的托管服务一起使用。
## {{% heading "prerequisites" %}}
@ -30,7 +34,7 @@ Use the [Service Catalog Installer](https://github.com/GoogleCloudPlatform/k8s-s
* Install [Go 1.6+](https://golang.org/dl/) and set the `GOPATH`.
* Install the [cfssl](https://github.com/cloudflare/cfssl) tool needed for generating SSL artifacts.
* Service Catalog requires Kubernetes version 1.7+.
* [Install and setup kubectl](/docs/tasks/tools/install-kubectl/) so that it is configured to connect to a Kubernetes v1.7+ cluster.
* [Install and setup kubectl](/docs/tasks/tools/) so that it is configured to connect to a Kubernetes v1.7+ cluster.
* The kubectl user must be bound to the *cluster-admin* role for it to install Service Catalog. To ensure that this is true, run the following command:
kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=<user-name>
@ -40,7 +44,7 @@ Use the [Service Catalog Installer](https://github.com/GoogleCloudPlatform/k8s-s
* 安装 [Go 1.6+](https://golang.org/dl/) 以及设置 `GOPATH`
* 安装生成 SSL 工件所需的 [cfssl](https://github.com/cloudflare/cfssl) 工具。
* 服务目录需要 Kubernetes 1.7+ 版本。
* [安装和设置 kubectl](/zh/docs/tasks/tools/install-kubectl/)
* [安装和设置 kubectl](/zh/docs/tasks/tools/)
以便将其配置为连接到 Kubernetes v1.7+ 集群。
* 要安装服务目录kubectl 用户必须绑定到 *cluster-admin* 角色。
为了确保这是正确的,请运行以下命令:
@ -53,20 +57,24 @@ Use the [Service Catalog Installer](https://github.com/GoogleCloudPlatform/k8s-s
<!--
## Install `sc` in your local environment
Install the `sc` CLI tool using the `go get` command:
The installer runs on your local computer as a CLI tool named `sc`.
Install using `go get`:
-->
## 在本地环境中安装 `sc`
使用 `go get` 命令安装 `sc` CLI 工具:
安装程序在你的本地计算机上以 CLI 工具的形式运行,名为 `sc`
```Go
使用 `go get` 安装:
```shell
go get github.com/GoogleCloudPlatform/k8s-service-catalog/installer/cmd/sc
```
<!--
After running the above command, `sc` should be installed in your `GOPATH/bin` directory.
`sc` should now be installed in your `GOPATH/bin` directory.
-->
执行上述命令后,`sc` 应被安装在 `GOPATH/bin` 目录中了。
现在,`sc` 应该已经被安装在 `GOPATH/bin` 目录中了。
<!--
## Install Service Catalog in your Kubernetes cluster