diff --git a/content/zh-cn/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume.md b/content/zh-cn/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume.md index ed057170d86..21ca5b0a649 100644 --- a/content/zh-cn/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume.md +++ b/content/zh-cn/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume.md @@ -33,7 +33,7 @@ In this exercise, you create a Pod that runs two Containers. The two containers share a Volume that they can use to communicate. Here is the configuration file for the Pod: --> -## 创建一个包含两个容器的 Pod +## 创建一个包含两个容器的 Pod {#creating-a-pod-that-runs-two-containers} 在这个练习中,你会创建一个包含两个容器的 Pod。两个容器共享一个卷用于他们之间的通信。 Pod 的配置文件如下: @@ -184,7 +184,7 @@ Typically this is done through a shared filesystem, as shown in this exercise, or through the loopback network interface, localhost. An example of this pattern is a web server along with a helper program that polls a Git repository for new updates. --> -## 讨论 +## 讨论 {#discussion} Pod 能有多个容器的主要原因是为了支持辅助应用(helper applications),以协助主应用(primary application)。 辅助应用的典型例子是数据抽取,数据推送和代理。辅助应用和主应用经常需要相互通信。 diff --git a/content/zh-cn/docs/tasks/access-application-cluster/connecting-frontend-backend.md b/content/zh-cn/docs/tasks/access-application-cluster/connecting-frontend-backend.md index 90583761edc..f66af51711d 100644 --- a/content/zh-cn/docs/tasks/access-application-cluster/connecting-frontend-backend.md +++ b/content/zh-cn/docs/tasks/access-application-cluster/connecting-frontend-backend.md @@ -61,7 +61,7 @@ require a supported environment. If your environment does not support this, you The backend is a simple hello greeter microservice. Here is the configuration file for the backend Deployment: --> -### 使用部署对象(Deployment)创建后端 +### 使用部署对象(Deployment)创建后端 {#creating-the-backend-using-a-deployment} 后端是一个简单的 hello 欢迎微服务应用。这是后端应用的 Deployment 配置文件: @@ -136,7 +136,7 @@ the Pods that it routes traffic to. First, explore the Service configuration file: --> -### 创建 `hello` Service 对象 +### 创建 `hello` Service 对象 {#creating-the-hello-service-object} 将请求从前端发送到后端的关键是后端 Service。Service 创建一个固定 IP 和 DNS 解析名入口, 使得后端微服务总是可达。Service 使用 @@ -185,7 +185,7 @@ configuration file. The Pods in the frontend Deployment run a nginx image that is configured to proxy requests to the `hello` backend Service. Here is the nginx configuration file: --> -### 创建前端应用 +### 创建前端 {#creating-the-frontend} 现在你已经有了运行中的后端应用,你可以创建一个可在集群外部访问的前端,并通过代理 前端的请求连接到后端。 @@ -299,7 +299,7 @@ cluster. The frontend and backend are now connected. You can hit the endpoint by using the curl command on the external IP of your frontend Service. --> -### 通过前端发送流量 +### 通过前端发送流量 {#send-traffic-through-the-frontend} 前端和后端已经完成连接了。你可以使用 curl 命令通过你的前端 Service 的外部 IP 访问服务端点。 diff --git a/content/zh-cn/docs/tasks/access-application-cluster/list-all-running-container-images.md b/content/zh-cn/docs/tasks/access-application-cluster/list-all-running-container-images.md index 3ae5e5cee81..571b51b5dda 100644 --- a/content/zh-cn/docs/tasks/access-application-cluster/list-all-running-container-images.md +++ b/content/zh-cn/docs/tasks/access-application-cluster/list-all-running-container-images.md @@ -45,7 +45,7 @@ of Containers for each. - Use `sort` to sort the results - Use `uniq` to aggregate image counts --> -## 列出所有命名空间下的所有容器镜像 +## 列出所有命名空间下的所有容器镜像 {#list-all-container-images-in-all-namespaces} - 使用 `kubectl get pods --all-namespaces` 获取所有命名空间下的所有 Pod - 使用 `-o jsonpath={.items[*].spec.containers[*].image}` 来格式化输出,以仅包含容器镜像名称。 @@ -95,7 +95,7 @@ Pod is returned instead of a list of items. The formatting can be controlled further by using the `range` operation to iterate over elements individually. --> -## 按 Pod 列出容器镜像 +## 按 Pod 列出容器镜像 {#list-container-images-by-pod} 可以使用 `range` 操作进一步控制格式化,以单独操作每个元素。 @@ -110,7 +110,7 @@ sort To target only Pods matching a specific label, use the -l flag. The following matches only Pods with labels matching `app=nginx`. --> -## 列出以标签过滤后的 Pod 的所有容器镜像 +## 列出以标签过滤后的 Pod 的所有容器镜像 {#list-container-images-filtering-by-pod-label} 要获取匹配特定标签的 Pod,请使用 -l 参数。以下匹配仅与标签 `app=nginx` 相符的 Pod。 @@ -124,7 +124,7 @@ kubectl get pods --all-namespaces -o jsonpath="{.items[*].spec.containers[*].ima To target only pods in a specific namespace, use the namespace flag. The following matches only Pods in the `kube-system` namespace. --> -## 列出以命名空间过滤后的 Pod 的所有容器镜像 +## 列出以命名空间过滤后的 Pod 的所有容器镜像 {#list-container-images-filtering-by-pod-namespace} 要获取匹配特定命名空间的 Pod,请使用 namespace 参数。以下仅匹配 `kube-system` 命名空间下的 Pod。 @@ -138,7 +138,7 @@ kubectl get pods --namespace kube-system -o jsonpath="{.items[*].spec.containers As an alternative to jsonpath, Kubectl supports using [go-templates](https://pkg.go.dev/text/template) for formatting the output: --> -## 使用 go-template 代替 jsonpath 来获取容器镜像 +## 使用 go-template 代替 jsonpath 来获取容器镜像 {#list-container-images-using-a-go-template-instead-of-jsonpath} 作为 jsonpath 的替代,Kubectl 支持使用 [go-templates](https://pkg.go.dev/text/template) 来格式化输出: @@ -154,7 +154,7 @@ kubectl get pods --all-namespaces -o go-template --template="{{range .items}}{{r * [Jsonpath](/docs/reference/kubectl/jsonpath/) reference guide * [Go template](https://pkg.go.dev/text/template) reference guide --> -### 参考 +### 参考 {#reference} * [Jsonpath](/zh-cn/docs/reference/kubectl/jsonpath/) 参考指南 * [Go template](https://pkg.go.dev/text/template) 参考指南 diff --git a/content/zh-cn/docs/tasks/access-application-cluster/port-forward-access-application-cluster.md b/content/zh-cn/docs/tasks/access-application-cluster/port-forward-access-application-cluster.md index 69a376cfa2d..1f67c2d9dbe 100644 --- a/content/zh-cn/docs/tasks/access-application-cluster/port-forward-access-application-cluster.md +++ b/content/zh-cn/docs/tasks/access-application-cluster/port-forward-access-application-cluster.md @@ -36,7 +36,7 @@ for database debugging. 1. Create a Deployment that runs MongoDB: --> -## 创建 MongoDB Deployment 和服务 +## 创建 MongoDB Deployment 和服务 {#creating-mongodb-deployment-and-service} 1. 创建一个运行 MongoDB 的 Deployment: @@ -183,7 +183,7 @@ for database debugging. 1. `kubectl port-forward` allows using resource name, such as a pod name, to select a matching pod to port forward to. --> -## 转发一个本地端口到 Pod 端口 +## 转发一个本地端口到 Pod 端口 {#forward-a-local-port-to-a-port-on-the-pod} 1. `kubectl port-forward` 允许使用资源名称 (例如 Pod 名称)来选择匹配的 Pod 来进行端口转发。 @@ -237,7 +237,7 @@ for database debugging. ``` Forwarding from 127.0.0.1:28015 -> 27017 Forwarding from [::1]:28015 -> 27017 - ``` + ``` {{< note >}} 3. 在 MongoDB 命令行提示符下,输入 `ping` 命令: diff --git a/content/zh-cn/docs/tasks/access-application-cluster/web-ui-dashboard.md b/content/zh-cn/docs/tasks/access-application-cluster/web-ui-dashboard.md index 654c5d11a19..c76c95bd0cd 100644 --- a/content/zh-cn/docs/tasks/access-application-cluster/web-ui-dashboard.md +++ b/content/zh-cn/docs/tasks/access-application-cluster/web-ui-dashboard.md @@ -56,7 +56,7 @@ Dashboard 同时展示了 Kubernetes 集群中的资源状态信息和所有报 The Dashboard UI is not deployed by default. To deploy it, run the following command: --> -## 部署 Dashboard UI +## 部署 Dashboard UI {#deploying-the-dashboard-ui} 默认情况下不会部署 Dashboard。可以通过以下命令部署: ``` @@ -71,7 +71,7 @@ Currently, Dashboard only supports logging in with a Bearer Token. To create a token for this demo, you can follow our guide on [creating a sample user](https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md). --> -## 访问 Dashboard 用户界面 +## 访问 Dashboard 用户界面 {#accessing-the-dashboard-ui} 为了保护你的集群数据,默认情况下,Dashboard 会使用最少的 RBAC 配置进行部署。 当前,Dashboard 仅支持使用 Bearer 令牌登录。 @@ -92,7 +92,7 @@ The sample user created in the tutorial will have administrative privileges and You can enable access to the Dashboard using the `kubectl` command-line tool, by running the following command: --> -### 命令行代理 +### 命令行代理 {#command-line-proxy} 你可以使用 `kubectl` 命令行工具来启用 Dashboard 访问,命令如下: @@ -121,7 +121,7 @@ Kubeconfig 身份验证方法**不**支持外部身份提供程序或基于 x509 -## 欢迎界面 +## 欢迎界面 {#welcome-view} -## 部署容器化应用 +## 部署容器化应用 {#deploying-containerized-applications} 通过一个简单的部署向导,你可以使用 Dashboard 将容器化应用作为一个 Deployment 和可选的 Service 进行创建和部署。你可以手工指定应用的详细配置,或者上传一个包含应用配置的 YAML @@ -161,7 +161,7 @@ Click the **CREATE** button in the upper right corner of any page to begin. The deploy wizard expects that you provide the following information: --> -### 指定应用的详细配置 +### 指定应用的详细配置 {#specifying-application-details} 部署向导需要你提供以下信息: @@ -380,7 +380,7 @@ Kubernetes supports declarative configuration. In this style, all configuration is stored in manifests (YAML or JSON configuration files). The manifests use Kubernetes [API](/docs/concepts/overview/kubernetes-api/) resource schemas. --> -### 上传 YAML 或者 JSON 文件 +### 上传 YAML 或者 JSON 文件 {#uploading-a-yaml-or-json-file} Kubernetes 支持声明式配置。所有的配置都存储在清单文件 (YAML 或者 JSON 配置文件)中。这些 @@ -398,7 +398,7 @@ Dashboard 上传文件。 Following sections describe views of the Kubernetes Dashboard UI; what they provide and how can they be used. --> -## 使用 Dashboard +## 使用 Dashboard {#using-dashboard} 以下各节描述了 Kubernetes Dashboard UI 视图;包括它们提供的内容,以及怎么使用它们。 @@ -409,7 +409,7 @@ When there are Kubernetes objects defined in the cluster, Dashboard shows them i By default only objects from the _default_ namespace are shown and this can be changed using the namespace selector located in the navigation menu. --> -### 导航 +### 导航 {#navigation} 当在集群中定义 Kubernetes 对象时,Dashboard 会在初始视图中显示它们。 默认情况下只会显示 _默认_ 名字空间中的对象,可以通过更改导航栏菜单中的名字空间筛选器进行改变。 @@ -427,7 +427,7 @@ Node list view contains CPU and memory usage metrics aggregated across all Nodes The details view shows the metrics for a Node, its specification, status, allocated resources, events and pods running on the node. --> -#### 管理概述 +#### 管理概述 {#admin-overview} 集群和名字空间管理的视图,Dashboard 会列出节点、名字空间和持久卷,并且有它们的详细视图。 节点列表视图包含从所有节点聚合的 CPU 和内存使用的度量值。 @@ -442,7 +442,7 @@ Each workload kind can be viewed separately. The lists summarize actionable information about the workloads, such as the number of ready pods for a ReplicaSet or current memory usage for a Pod. --> -#### 负载 +#### 负载 {#workloads} 显示选中的名字空间中所有运行的应用。 视图按照负载类型(例如:Deployment、ReplicaSet、StatefulSet)罗列应用,并且每种负载都可以单独查看。 @@ -465,7 +465,7 @@ discovering them within a cluster. For that reason, Service and Ingress views show Pods targeted by them, internal endpoints for cluster connections and external endpoints for external users. --> -#### 服务 +#### 服务 {#services} 展示允许暴露给外网服务和允许集群内部发现的 Kubernetes 资源。 因此,Service 和 Ingress 视图展示他们关联的 Pod、给集群连接使用的内部端点和给外部用户使用的外部端点。 @@ -475,7 +475,7 @@ internal endpoints for cluster connections and external endpoints for external u Storage view shows PersistentVolumeClaim resources which are used by applications for storing data. --> -#### 存储 +#### 存储 {#storage} 存储视图展示持久卷申领(PVC)资源,这些资源被应用程序用来存储数据。 @@ -496,7 +496,7 @@ The view allows for editing and managing config objects and displays secrets hid Pod lists and detail pages link to a logs viewer that is built into Dashboard. The viewer allows for drilling down logs from containers belonging to a single Pod. --> -#### 日志查看器 +#### 日志查看器 {#logs-viewer} Pod 列表和详细信息页面可以链接到 Dashboard 内置的日志查看器。 查看器可以深入查看属于同一个 Pod 的不同容器的日志。