From 65bc0c757360f6d105d8c8131d267daf03b484e0 Mon Sep 17 00:00:00 2001 From: "xin.li" Date: Sat, 20 Jan 2024 23:03:53 +0800 Subject: [PATCH] [zh-cn] sync install-kubectl-linux pull-image-private-registry configure-pod-configmap Signed-off-by: xin.li --- .../configure-pod-configmap.md | 53 +++++++++++-------- .../pull-image-private-registry.md | 8 +-- .../docs/tasks/tools/install-kubectl-linux.md | 47 +++++++++------- 3 files changed, 64 insertions(+), 44 deletions(-) diff --git a/content/zh-cn/docs/tasks/configure-pod-container/configure-pod-configmap.md b/content/zh-cn/docs/tasks/configure-pod-container/configure-pod-configmap.md index c915d03b80f77..13be9b0d17151 100644 --- a/content/zh-cn/docs/tasks/configure-pod-container/configure-pod-configmap.md +++ b/content/zh-cn/docs/tasks/configure-pod-container/configure-pod-configmap.md @@ -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)。 用于创建 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 -输出类似以下内容: +输出类似以下内容: ```yaml apiVersion: v1 @@ -289,7 +289,7 @@ kubectl create configmap game-config-2 --from-file=configure-pod-container/confi -将产生以下 ConfigMap: +将产生以下 ConfigMap: ```shell kubectl describe configmaps game-config-2 @@ -298,7 +298,7 @@ kubectl describe configmaps game-config-2 -输出类似以下内容: +输出类似以下内容: ``` Name: game-config-2 @@ -341,7 +341,7 @@ kubectl describe configmaps game-config-2 -输出类似以下内容: +输出类似以下内容: ``` Name: game-config-2 @@ -466,7 +466,7 @@ kubectl create configmap config-multi-env-files \ -将产生以下 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 -输出类似以下内容: +输出类似以下内容: ```yaml apiVersion: v1 @@ -524,7 +524,7 @@ location of the data source file you want the key to represent. -例如: +例如: ```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 -将产生以下 ConfigMap: +将产生以下 ConfigMap: ```shell kubectl get configmaps game-config-3 -o yaml @@ -592,7 +592,7 @@ kubectl get configmaps special-config -o yaml -输出类似以下内容: +输出类似以下内容: ```yaml apiVersion: v1 @@ -834,7 +834,7 @@ section, and learn how to use these objects with Pods. -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: -* 创建 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 -此 Pod 在 `test-container` 容器中产生以下输出: +此 Pod 在 `test-container` 容器中产生以下输出: + ```shell kubectl logs dapi-test-pod ``` @@ -1161,11 +1162,21 @@ kubectl delete pod dapi-test-pod --now +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 diff --git a/content/zh-cn/docs/tasks/configure-pod-container/pull-image-private-registry.md b/content/zh-cn/docs/tasks/configure-pod-container/pull-image-private-registry.md index b3d0b580f9d3b..0131d6b09c9e4 100644 --- a/content/zh-cn/docs/tasks/configure-pod-container/pull-image-private-registry.md +++ b/content/zh-cn/docs/tasks/configure-pod-container/pull-image-private-registry.md @@ -13,8 +13,8 @@ weight: 130 @@ -32,8 +32,8 @@ as an example registry. * 要进行此练习,你需要 `docker` 命令行工具和一个知道密码的 [Docker ID](https://docs.docker.com/docker-id/)。 diff --git a/content/zh-cn/docs/tasks/tools/install-kubectl-linux.md b/content/zh-cn/docs/tasks/tools/install-kubectl-linux.md index 2d0f82fb36dc3..aa696ae0fcb0e 100644 --- a/content/zh-cn/docs/tasks/tools/install-kubectl-linux.md +++ b/content/zh-cn/docs/tasks/tools/install-kubectl-linux.md @@ -217,10 +217,24 @@ Or use this for detailed view of version: 2. 下载 Kubernetes 软件包仓库的公共签名密钥。 同一个签名密钥适用于所有仓库,因此你可以忽略 URL 中的版本信息: + ```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 >}} + +在低于 Debian 12 和 Ubuntu 22.04 的发行版本中,`/etc/apt/keyrings` 默认不存在。 +应在 curl 命令之前创建它。 +{{< /note >}} + -在低于 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 # 这将覆盖 /etc/zypp/repos.d/kubernetes.repo 中的任何现有配置。 cat <}} 要升级 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. 使用 `zypper` 安装 kubectl: - ```bash - sudo zypper install -y kubectl - ``` + --> + 2. 使用 `zypper` 安装 kubectl: + + ```bash + sudo zypper install -y kubectl + ``` {{% /tab %}}