[zh-cn] sync install-kubectl-linux pull-image-private-registry configure-pod-configmap
Signed-off-by: xin.li <xin.li@daocloud.io>
This commit is contained in:
parent
2df06423a8
commit
65bc0c7573
|
|
@ -99,7 +99,7 @@ The name of a ConfigMap object must be a valid
|
|||
-->
|
||||
其中,`<映射名称>` 是为 ConfigMap 指定的名称,`<数据源>` 是要从中提取数据的目录、
|
||||
文件或者字面值。ConfigMap 对象的名称必须是合法的
|
||||
[DNS 子域名](/zh-cn/docs/concepts/overview/working-with-objects/names#dns-subdomain-names).
|
||||
[DNS 子域名](/zh-cn/docs/concepts/overview/working-with-objects/names#dns-subdomain-names)。
|
||||
|
||||
<!--
|
||||
When you are creating a ConfigMap based on a file, the key in the \<data-source> defaults to
|
||||
|
|
@ -140,7 +140,7 @@ If you use `kubectl create configmap` with a directory where any of the file nam
|
|||
an unacceptable character, the `kubectl` command may fail.
|
||||
-->
|
||||
用于创建 ConfigMap 的每个文件名必须由可接受的字符组成,即:字母(`A` 到 `Z` 和
|
||||
`a` 到 `z`)、数字(`0` 到 `9`)、'-'、'_'或'.'。
|
||||
`a` 到 `z`)、数字(`0` 到 `9`)、'-'、'_' 或 '.'。
|
||||
如果在一个目录中使用 `kubectl create configmap`,而其中任一文件名包含不可接受的字符,
|
||||
则 `kubectl` 命令可能会失败。
|
||||
|
||||
|
|
@ -241,7 +241,7 @@ kubectl get configmaps game-config -o yaml
|
|||
<!--
|
||||
The output is similar to this:
|
||||
-->
|
||||
输出类似以下内容:
|
||||
输出类似以下内容:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
|
|
@ -289,7 +289,7 @@ kubectl create configmap game-config-2 --from-file=configure-pod-container/confi
|
|||
<!--
|
||||
would produce the following ConfigMap:
|
||||
-->
|
||||
将产生以下 ConfigMap:
|
||||
将产生以下 ConfigMap:
|
||||
|
||||
```shell
|
||||
kubectl describe configmaps game-config-2
|
||||
|
|
@ -298,7 +298,7 @@ kubectl describe configmaps game-config-2
|
|||
<!--
|
||||
where the output is similar to this:
|
||||
-->
|
||||
输出类似以下内容:
|
||||
输出类似以下内容:
|
||||
|
||||
```
|
||||
Name: game-config-2
|
||||
|
|
@ -341,7 +341,7 @@ kubectl describe configmaps game-config-2
|
|||
<!--
|
||||
The output is similar to this:
|
||||
-->
|
||||
输出类似以下内容:
|
||||
输出类似以下内容:
|
||||
|
||||
```
|
||||
Name: game-config-2
|
||||
|
|
@ -466,7 +466,7 @@ kubectl create configmap config-multi-env-files \
|
|||
<!--
|
||||
would produce the following ConfigMap:
|
||||
-->
|
||||
将产生以下 ConfigMap:
|
||||
将产生以下 ConfigMap:
|
||||
|
||||
```shell
|
||||
kubectl get configmap config-multi-env-files -o yaml
|
||||
|
|
@ -475,7 +475,7 @@ kubectl get configmap config-multi-env-files -o yaml
|
|||
<!--
|
||||
where the output is similar to this:
|
||||
-->
|
||||
输出类似以下内容:
|
||||
输出类似以下内容:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
|
|
@ -524,7 +524,7 @@ location of the data source file you want the key to represent.
|
|||
<!--
|
||||
For example:
|
||||
-->
|
||||
例如:
|
||||
例如:
|
||||
|
||||
```shell
|
||||
kubectl create configmap game-config-3 --from-file=game-special-key=configure-pod-container/configmap/game.properties
|
||||
|
|
@ -533,7 +533,7 @@ kubectl create configmap game-config-3 --from-file=game-special-key=configure-po
|
|||
<!--
|
||||
would produce the following ConfigMap:
|
||||
-->
|
||||
将产生以下 ConfigMap:
|
||||
将产生以下 ConfigMap:
|
||||
|
||||
```shell
|
||||
kubectl get configmaps game-config-3 -o yaml
|
||||
|
|
@ -592,7 +592,7 @@ kubectl get configmaps special-config -o yaml
|
|||
<!--
|
||||
The output is similar to this:
|
||||
-->
|
||||
输出类似以下内容:
|
||||
输出类似以下内容:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
|
|
@ -834,7 +834,7 @@ section, and learn how to use these objects with Pods.
|
|||
<!--
|
||||
1. Define an environment variable as a key-value pair in a ConfigMap:
|
||||
-->
|
||||
1. 在 ConfigMap 中将环境变量定义为键值对:
|
||||
1. 在 ConfigMap 中将环境变量定义为键值对:
|
||||
|
||||
```shell
|
||||
kubectl create configmap special-config --from-literal=special.how=very
|
||||
|
|
@ -879,7 +879,7 @@ Here is the manifest you will use:
|
|||
<!--
|
||||
* Create the ConfigMap:
|
||||
-->
|
||||
* 创建 ConfigMap:
|
||||
* 创建 ConfigMap:
|
||||
|
||||
```shell
|
||||
kubectl create -f https://kubernetes.io/examples/configmap/configmaps.yaml
|
||||
|
|
@ -1000,7 +1000,8 @@ kubectl create -f https://kubernetes.io/examples/pods/pod-configmap-env-var-valu
|
|||
<!--
|
||||
That pod produces the following output from the `test-container` container:
|
||||
-->
|
||||
此 Pod 在 `test-container` 容器中产生以下输出:
|
||||
此 Pod 在 `test-container` 容器中产生以下输出:
|
||||
|
||||
```shell
|
||||
kubectl logs dapi-test-pod
|
||||
```
|
||||
|
|
@ -1161,11 +1162,21 @@ kubectl delete pod dapi-test-pod --now
|
|||
<!--
|
||||
### Project keys to specific paths and file permissions
|
||||
|
||||
You can project keys to specific paths and specific permissions on a per-file
|
||||
basis. The
|
||||
[Secrets](/docs/concepts/configuration/secret/#using-secrets-as-files-from-a-pod)
|
||||
guide explains the syntax.
|
||||
You can project keys to specific paths.
|
||||
Refer to the corresponding section in the
|
||||
[Secrets](/docs/tasks/inject-data-application/distribute-credentials-secure/#project-secret-keys-to-specific-file-paths)
|
||||
guide for the syntax.
|
||||
You can set POSIX permissions for keys.
|
||||
Refer to the corresponding section in the
|
||||
[Secrets](/docs/tasks/inject-data-application/distribute-credentials-secure/#set-posix-permissions-for-secret-keys)
|
||||
guide for the syntax.
|
||||
-->
|
||||
你可以将密钥投射到特定路径,语法请参阅
|
||||
[Secret](/zh-cn/docs/tasks/inject-data-application/distribute-credentials-secure/#project-secret-keys-to-specific-file-paths)
|
||||
指南中的相应部分。
|
||||
你可以设置密钥的 POSIX 权限,语法请参阅
|
||||
[Secret](/docs/tasks/inject-data-application/distribute-credentials-secure/#set-posix-permissions-for-secret-keys)
|
||||
指南中的相应部分。
|
||||
|
||||
### 映射键到指定路径并设置文件访问权限 {#project-keys-to-specific-paths-and-file-permissions}
|
||||
|
||||
|
|
@ -1211,7 +1222,7 @@ can trigger an immediate refresh by updating one of the pod's annotations.
|
|||
Kubelet 在每次定期同步时都会检查所挂载的 ConfigMap 是否是最新的。
|
||||
然而,它使用其基于 TTL 机制的本地缓存来获取 ConfigMap 的当前值。
|
||||
因此,从 ConfigMap 更新到新键映射到 Pod 的总延迟可能与 kubelet
|
||||
同步周期(默认为1分钟)+ kubelet 中 ConfigMap 缓存的 TTL(默认为1分钟)一样长。
|
||||
同步周期(默认为 1 分钟)+ kubelet 中 ConfigMap 缓存的 TTL(默认为 1 分钟)一样长。
|
||||
你可以通过更新 Pod 的一个注解来触发立即刷新。
|
||||
|
||||
{{< note >}}
|
||||
|
|
@ -1437,7 +1448,7 @@ spec:
|
|||
-->
|
||||
- 如果你使用 `envFrom` 来基于 ConfigMap 定义环境变量,那么无效的键将被忽略。
|
||||
Pod 可以被启动,但无效名称将被记录在事件日志中(`InvalidVariableNames`)。
|
||||
日志消息列出了每个被跳过的键。例如:
|
||||
日志消息列出了每个被跳过的键。例如:
|
||||
|
||||
```shell
|
||||
kubectl get events
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ weight: 130
|
|||
|
||||
<!--
|
||||
This page shows how to create a Pod that uses a
|
||||
{{< glossary_tooltip text="Secret" term_id="secret" >}} to pull an image
|
||||
from a private container image registry or repository. There are many private
|
||||
{{< glossary_tooltip text="Secret" term_id="secret" >}} to pull an image
|
||||
from a private container image registry or repository. There are many private
|
||||
registries in use. This task uses [Docker Hub](https://www.docker.com/products/docker-hub)
|
||||
as an example registry.
|
||||
-->
|
||||
|
|
@ -32,8 +32,8 @@ as an example registry.
|
|||
<!--
|
||||
* To do this exercise, you need the `docker` command line tool, and a
|
||||
[Docker ID](https://docs.docker.com/docker-id/) for which you know the password.
|
||||
* If you are using a different private container registry, you need the command
|
||||
line tool for that registry and any login information for the registry.
|
||||
* If you are using a different private container registry, you need the command
|
||||
line tool for that registry and any login information for the registry.
|
||||
-->
|
||||
* 要进行此练习,你需要 `docker` 命令行工具和一个知道密码的
|
||||
[Docker ID](https://docs.docker.com/docker-id/)。
|
||||
|
|
|
|||
|
|
@ -217,10 +217,24 @@ Or use this for detailed view of version:
|
|||
2. 下载 Kubernetes 软件包仓库的公共签名密钥。
|
||||
同一个签名密钥适用于所有仓库,因此你可以忽略 URL 中的版本信息:
|
||||
|
||||
<!--
|
||||
# If the folder `/etc/apt/keyrings` does not exist, it should be created before the curl command, read the note below.
|
||||
# sudo mkdir -p -m 755 /etc/apt/keyrings
|
||||
-->
|
||||
```shell
|
||||
# 如果 `/etc/apt/keyrings` 目录不存在,则应在 curl 命令之前创建它,请阅读下面的注释。
|
||||
# sudo mkdir -p -m 755 /etc/apt/keyrings
|
||||
curl -fsSL https://pkgs.k8s.io/core:/stable:/{{< param "version" >}}/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
|
||||
```
|
||||
|
||||
{{< note >}}
|
||||
<!--
|
||||
In releases older than Debian 12 and Ubuntu 22.04, folder `/etc/apt/keyrings` does not exist by default, and it should be created before the curl command.
|
||||
-->
|
||||
在低于 Debian 12 和 Ubuntu 22.04 的发行版本中,`/etc/apt/keyrings` 默认不存在。
|
||||
应在 curl 命令之前创建它。
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
3. Add the appropriate Kubernetes `apt` repository. If you want to use Kubernetes version different than {{< param "version" >}},
|
||||
replace {{< param "version" >}} with the desired minor version in the command below:
|
||||
|
|
@ -262,14 +276,6 @@ Or use this for detailed view of version:
|
|||
sudo apt-get install -y kubectl
|
||||
```
|
||||
|
||||
{{< note >}}
|
||||
<!--
|
||||
In releases older than Debian 12 and Ubuntu 22.04, `/etc/apt/keyrings` does not exist by default, and can be created using `sudo mkdir -m 755 /etc/apt/keyrings`
|
||||
-->
|
||||
在低于 Debian 12 和 Ubuntu 22.04 的发行版本中,`/etc/apt/keyrings` 默认不存在。
|
||||
可以使用 `sudo mkdir -m 755 /etc/apt/keyrings` 来创建。
|
||||
{{< /note >}}
|
||||
|
||||
{{% /tab %}}
|
||||
|
||||
{{% tab name="基于 Red Hat 的发行版" %}}
|
||||
|
|
@ -334,7 +340,8 @@ different than {{< param "version" >}}, replace {{< param "version" >}} with
|
|||
the desired minor version in the command below.
|
||||
-->
|
||||
|
||||
1. 添加 Kubernetes `zypper` 软件源。如果您想使用不同于 {{< param "version" >}} 的 Kubernetes 版本,请在下面的命令中将 {{< param "version" >}} 替换为所需的次要版本。
|
||||
1. 添加 Kubernetes `zypper` 软件源。如果你想使用不同于 {{< param "version" >}}
|
||||
的 Kubernetes 版本,请在下面的命令中将 {{< param "version" >}} 替换为所需的次要版本。
|
||||
|
||||
<!--
|
||||
```bash
|
||||
|
|
@ -348,7 +355,7 @@ gpgcheck=1
|
|||
gpgkey=https://pkgs.k8s.io/core:/stable:/{{< param "version" >}}/rpm/repodata/repomd.xml.key
|
||||
EOF
|
||||
```
|
||||
-->
|
||||
-->
|
||||
```bash
|
||||
# 这将覆盖 /etc/zypp/repos.d/kubernetes.repo 中的任何现有配置。
|
||||
cat <<EOF | sudo tee /etc/zypp/repos.d/kubernetes.repo
|
||||
|
|
@ -362,20 +369,22 @@ EOF
|
|||
```
|
||||
{{< note >}}
|
||||
<!--
|
||||
To upgrade kubectl to another minor release, you'll need to bump the version in `/etc/zypp/repos.d/kubernetes.repo` before running `zypper update`. This procedure is described in more detail in
|
||||
[Changing The Kubernetes Package Repository](/docs/tasks/administer-cluster/kubeadm/change-package-repository/).
|
||||
To upgrade kubectl to another minor release, you'll need to bump the version in `/etc/zypp/repos.d/kubernetes.repo` before running `zypper update`. This procedure is described in more detail in
|
||||
[Changing The Kubernetes Package Repository](/docs/tasks/administer-cluster/kubeadm/change-package-repository/).
|
||||
-->
|
||||
要升级 kubectl 到另一个小版本,你需要先更新 `/etc/zypp/repos.d/kubernetes.repo` 的版本,
|
||||
再运行 `zypper update`。此过程在[更改 Kubernetes 软件包仓库](/zh-cn/docs/tasks/administer-cluster/kubeadm/change-package-repository/) 中有更详细的描述。
|
||||
再运行 `zypper update`。
|
||||
此过程在[更改 Kubernetes 软件包仓库](/zh-cn/docs/tasks/administer-cluster/kubeadm/change-package-repository/)中有更详细的描述。
|
||||
{{< /note >}}
|
||||
|
||||
<!--
|
||||
<!--
|
||||
2. Install kubectl using `zypper`:
|
||||
-->
|
||||
2. 使用 `zypper` 安装 kubectl:
|
||||
```bash
|
||||
sudo zypper install -y kubectl
|
||||
```
|
||||
-->
|
||||
2. 使用 `zypper` 安装 kubectl:
|
||||
|
||||
```bash
|
||||
sudo zypper install -y kubectl
|
||||
```
|
||||
|
||||
{{% /tab %}}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue