Skip to content

Commit b439c8b

Browse files
authored
Merge pull request #40457 from fenggw-fnst/sync-hello-minikube
[zh-cn] Sync tutorials/hello-minikube.md
2 parents cf616b4 + 5fc21f6 commit b439c8b

File tree

1 file changed

+74
-80
lines changed

1 file changed

+74
-80
lines changed

content/zh-cn/docs/tutorials/hello-minikube.md

Lines changed: 74 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,11 @@ card:
3030
<!-- overview -->
3131

3232
<!--
33-
This tutorial shows you how to run a sample app
34-
on Kubernetes using minikube and Katacoda.
35-
Katacoda provides a free, in-browser Kubernetes environment.
33+
This tutorial shows you how to run a sample app on Kubernetes using minikube.
34+
The tutorial provides a container image that uses NGINX to echo back all the requests.
3635
-->
37-
本教程向你展示如何使用 Minikube 和 Katacoda
38-
在 Kubernetes 上运行一个应用示例。Katacoda 提供免费的浏览器内 Kubernetes 环境。
39-
40-
{{< note >}}
41-
<!--
42-
You can also follow this tutorial if you've installed minikube locally.
43-
See [minikube start](https://minikube.sigs.k8s.io/docs/start/) for installation instructions.
44-
-->
45-
如果你已在本地安装 Minikube,也可以按照本教程操作。
46-
安装指南参阅 [minikube start](https://minikube.sigs.k8s.io/docs/start/)
47-
{{< /note >}}
36+
本教程向你展示如何使用 Minikube 在 Kubernetes 上运行一个应用示例。
37+
教程提供了容器镜像,使用 NGINX 来对所有请求做出回应。
4838

4939
## {{% heading "objectives" %}}
5040

@@ -60,52 +50,54 @@ See [minikube start](https://minikube.sigs.k8s.io/docs/start/) for installation
6050
## {{% heading "prerequisites" %}}
6151

6252
<!--
63-
This tutorial provides a container image that uses NGINX to echo back all the requests.
53+
This tutorial assumes that you have already set up `minikube`.
54+
See [minikube start](https://minikube.sigs.k8s.io/docs/start/) for installation instructions.
55+
56+
You also need to install `kubectl`.
57+
See [Install tools](/docs/tasks/tools/#kubectl) for installation instructions.
6458
-->
65-
本教程提供了容器镜像,使用 NGINX 来对所有请求做出回应。
59+
本教程假设你已经安装了 `minikube`
60+
有关安装说明,请参阅 [minikube start](https://minikube.sigs.k8s.io/docs/start/)
61+
62+
你还需要安装 `kubectl`
63+
有关安装说明,请参阅[安装工具](/zh-cn/docs/tasks/tools/#kubectl)
6664

6765
<!-- lessoncontent -->
6866

6967
<!--
7068
## Create a minikube cluster
71-
72-
1. Click **Launch Terminal**.
7369
-->
7470
## 创建 Minikube 集群 {#create-a-minikube-cluster}
7571

76-
1. 点击 **Launch Terminal**
77-
78-
{{< kat-button >}}
79-
80-
{{< note >}}
81-
<!--
82-
If you installed minikube locally, run `minikube start`. Before you run `minikube dashboard`, you should open a new terminal, start `minikube dashboard` there, and then switch back to the main terminal.
83-
-->
84-
如果你在本地安装了 Minikube,运行 `minikube start`
85-
在运行 `minikube dashboard` 之前,你应该打开一个新终端,
86-
在此启动 `minikube dashboard` ,然后切换回主终端。
87-
{{< /note >}}
72+
```shell
73+
minikube start
74+
```
8875

8976
<!--
90-
2. Open the Kubernetes dashboard in a browser:
77+
## Open the Dashboard
78+
79+
Open the Kubernetes dashboard. You can do this two different ways:
9180
-->
92-
2. 在浏览器中打开 Kubernetes 仪表板(Dashboard):
81+
## 打开仪表板 {#open-the-dashboard}
9382

94-
```shell
95-
minikube dashboard
96-
```
83+
打开 Kubernetes 仪表板。你可以通过两种不同的方式执行此操作:
9784

85+
{{< tabs name="dashboard" >}}
86+
{{% tab name="启动浏览器" %}}
9887
<!--
99-
3. Katacoda environment only: At the top of the terminal pane, click the plus sign, and then click **Select port to view on Host 1**.
88+
Open a **new** terminal, and run:
10089
-->
101-
3. 仅限 Katacoda 环境:在终端窗口的顶部,单击加号,然后单击 **Select port to view on Host 1**
90+
打开一个**新的**终端,然后运行:
91+
```shell
92+
# 启动一个新的终端,并保持此命令运行。
93+
minikube dashboard
94+
```
10295

10396
<!--
104-
4. Katacoda environment only: Type `30000`, and then click **Display Port**.
97+
Now, switch back to the terminal where you ran `minikube start`.
10598
-->
106-
4. 仅限 Katacoda 环境:输入 `30000`,然后单击 **Display Port**
99+
现在,切换回运行 `minikube start` 的终端
107100

108-
{{< note >}}
109101
<!--
110102
The `dashboard` command enables the dashboard add-on and opens the proxy in the default web browser.
111103
You can create Kubernetes resources on the dashboard such as Deployment and Service.
@@ -119,6 +111,7 @@ To stop the proxy, run `Ctrl+C` to exit the process.
119111
After the command exits, the dashboard remains running in the Kubernetes cluster.
120112
You can run the `dashboard` command again to create another proxy to access the dashboard.
121113
-->
114+
{{< note >}}
122115
`dashboard` 命令启用仪表板插件,并在默认的 Web 浏览器中打开代理。
123116
你可以在仪表板上创建 Kubernetes 资源,例如 Deployment 和 Service。
124117

@@ -133,20 +126,32 @@ You can run the `dashboard` command again to create another proxy to access the
133126
你可以再次运行 `dashboard` 命令创建另一个代理来访问仪表板。
134127
{{< /note >}}
135128

136-
<!--
137-
## Open Dashboard with URL
138-
-->
139-
## 使用 URL 打开仪表板 {#open-dashboard-with-url}
129+
{{% /tab %}}
130+
{{% tab name="URL 复制粘贴" %}}
140131

141132
<!--
142-
If you don't want to open a web browser, run the dashboard command with the `--url` flag to emit a URL:
133+
If you don't want minikube to open a web browser for you, run the dashboard command with the
134+
`--url` flag. `minikube` outputs a URL that you can open in the browser you prefer.
135+
136+
Open a **new** terminal, and run:
143137
-->
144-
如果你不想打开 Web 浏览器,请使用 `--url` 标志运行显示板命令以得到 URL:
138+
如果你不想 Minikube 为你打开 Web 浏览器,可以使用 `--url` 标志运行仪表板命令。
139+
`minikube` 会输出一个 URL,你可以在你喜欢的浏览器中打开该 URL。
145140

141+
打开一个**新的**终端,然后运行:
146142
```shell
143+
# 启动一个新的终端,并保持此命令运行。
147144
minikube dashboard --url
148145
```
149146

147+
<!--
148+
Now, switch back to the terminal where you ran `minikube start`.
149+
-->
150+
现在,切换回运行 `minikube start` 的终端。
151+
152+
{{% /tab %}}
153+
{{< /tabs >}}
154+
150155
<!--
151156
## Create a Deployment
152157
@@ -165,26 +170,22 @@ Kubernetes [**Deployment**](/zh-cn/docs/concepts/workloads/controllers/deploymen
165170
检查 Pod 的健康状况,并在 Pod 中的容器终止的情况下重新启动新的容器。
166171
Deployment 是管理 Pod 创建和扩展的推荐方法。
167172

168-
<!--
169-
1. Katacoda environment only: At the top of the terminal pane, click the plus sign, and then **Open New Terminal**.
170-
-->
171-
1. 仅 Katacoda 环境:在终端窗格的顶部,点击加号,然后点击 **Open New Terminal**
172-
173173
<!--
174174
1. Use the `kubectl create` command to create a Deployment that manages a Pod. The
175-
Pod runs a Container based on the provided Docker image.
175+
Pod runs a Container based on the provided Docker image.
176176
-->
177-
2. 使用 `kubectl create` 命令创建管理 Pod 的 Deployment。该 Pod 根据提供的 Docker
177+
1. 使用 `kubectl create` 命令创建管理 Pod 的 Deployment。该 Pod 根据提供的 Docker
178178
镜像运行容器。
179179

180180
```shell
181+
# 运行包含 Web 服务器的测试容器镜像
181182
kubectl create deployment hello-node --image=registry.k8s.io/e2e-test-images/agnhost:2.39 -- /agnhost netexec --http-port=8080
182183
```
183184

184185
<!--
185186
1. View the Deployment:
186187
-->
187-
3. 查看 Deployment:
188+
2. 查看 Deployment:
188189

189190
```shell
190191
kubectl get deployments
@@ -204,7 +205,7 @@ Pod runs a Container based on the provided Docker image.
204205
<!--
205206
1. View the Pod:
206207
-->
207-
4. 查看 Pod:
208+
3. 查看 Pod:
208209

209210
```shell
210211
kubectl get pods
@@ -224,7 +225,7 @@ Pod runs a Container based on the provided Docker image.
224225
<!--
225226
1. View cluster events:
226227
-->
227-
5. 查看集群事件:
228+
4. 查看集群事件:
228229

229230
```shell
230231
kubectl get events
@@ -233,16 +234,15 @@ Pod runs a Container based on the provided Docker image.
233234
<!--
234235
1. View the `kubectl` configuration:
235236
-->
236-
6. 查看 `kubectl` 配置:
237+
5. 查看 `kubectl` 配置:
237238

238239
```shell
239240
kubectl config view
240241
```
241242

242243
{{< note >}}
243244
<!--
244-
For more information about `kubectl`commands, see the
245-
[kubectl overview](/docs/reference/kubectl/).
245+
For more information about `kubectl` commands, see the [kubectl overview](/docs/reference/kubectl/).
246246
-->
247247
有关 `kubectl` 命令的更多信息,请参阅 [kubectl 概述](/zh-cn/docs/reference/kubectl/)
248248
{{< /note >}}
@@ -274,13 +274,13 @@ Kubernetes [*Service*](/docs/concepts/services-networking/service/).
274274
The `--type=LoadBalancer` flag indicates that you want to expose your Service
275275
outside of the cluster.
276276
277-
The application code inside the image `registry.k8s.io/echoserver` only listens on TCP port 8080. If you used
277+
The application code inside the test image only listens on TCP port 8080. If you used
278278
`kubectl expose` to expose a different port, clients could not connect to that other port.
279279
-->
280280

281281
这里的 `--type=LoadBalancer` 参数表明你希望将你的 Service 暴露到集群外部。
282282

283-
镜像 `registry.k8s.io/echoserver` 中的应用程序代码仅监听 TCP 8080 端口。
283+
测试镜像中的应用程序代码仅监听 TCP 8080 端口。
284284
如果你用 `kubectl expose` 暴露了其它的端口,客户端将不能访问其它端口。
285285

286286
<!--
@@ -323,21 +323,9 @@ Kubernetes [*Service*](/docs/concepts/services-networking/service/).
323323
minikube service hello-node
324324
```
325325

326-
<!--
327-
4. Katacoda environment only: Click the plus sign, and then click **Select port to view on Host 1**.
328-
-->
329-
4. 仅限 Katacoda 环境:单击加号,然后单击 **Select port to view on Host 1**
330-
331-
<!--
332-
5. Katacoda environment only: Note the 5-digit port number displayed opposite to `8080` in services output. This port number is randomly generated and it can be different for you. Type your number in the port number text box, then click Display Port. Using the example from earlier, you would type `30369`.
333-
334-
This opens up a browser window that serves your app and shows the app's response.
335-
-->
336-
5. 仅限 Katacoda 环境:请注意在 service 输出中与 `8080` 对应的长度为 5 位的端口号。
337-
此端口号是随机生成的,可能与你的不同。
338-
在端口号文本框中输入你自己的端口号,然后单击 **Display Port**
339-
对应于上面的例子,需要输入 `30369`
340-
326+
<!--
327+
This opens up a browser window that serves your app and shows the app's response.
328+
-->
341329
这将打开一个浏览器窗口,为你的应用程序提供服务并显示应用的响应。
342330

343331
<!--
@@ -403,9 +391,9 @@ Minikube 有一组内置的{{< glossary_tooltip text="插件" term_id="addons" >
403391
```
404392

405393
<!--
406-
3. View the Pod and Service you created:
394+
3. View the Pod and Service you created by installing that addon:
407395
-->
408-
3. 查看创建的 Pod 和 Service:
396+
3. 查看通过安装该插件所创建的 Pod 和 Service:
409397

410398
```shell
411399
kubectl get pod,svc -n kube-system
@@ -472,9 +460,9 @@ kubectl delete deployment hello-node
472460
```
473461

474462
<!--
475-
Optionally, stop the Minikube virtual machine (VM):
463+
Stop the Minikube cluster
476464
-->
477-
可选地,停止 Minikube 虚拟机(VM)
465+
停止 Minikube 集群
478466

479467
```shell
480468
minikube stop
@@ -486,9 +474,15 @@ Optionally, delete the Minikube VM:
486474
可选地,删除 Minikube 虚拟机(VM):
487475

488476
```shell
477+
# 可选的
489478
minikube delete
490479
```
491480

481+
<!--
482+
If you want to use minikube again to learn more about Kubernetes, you don't need to delete it.
483+
-->
484+
如果你还想使用 Minikube 进一步学习 Kubernetes,那就不需要删除 Minikube。
485+
492486
## {{% heading "whatsnext" %}}
493487

494488
<!--

0 commit comments

Comments
 (0)