commit
d86ea7308e
|
@ -103,7 +103,7 @@ Now, switch back to the terminal where you ran `minikube start`.
|
|||
The `dashboard` command enables the dashboard add-on and opens the proxy in the default web browser.
|
||||
You can create Kubernetes resources on the dashboard such as Deployment and Service.
|
||||
|
||||
If you are running in an environment as root, see [Open Dashboard with URL](#open-dashboard-with-url).
|
||||
To find out how to avoid directly invoking the browser from the terminal and get a URL for the web dashboard, see the "URL copy and paste" tab.
|
||||
|
||||
By default, the dashboard is only accessible from within the internal Kubernetes virtual network.
|
||||
The `dashboard` command creates a temporary proxy to make the dashboard accessible from outside the Kubernetes virtual network.
|
||||
|
@ -116,8 +116,8 @@ You can run the `dashboard` command again to create another proxy to access the
|
|||
`dashboard` 命令启用仪表板插件,并在默认的 Web 浏览器中打开代理。
|
||||
你可以在仪表板上创建 Kubernetes 资源,例如 Deployment 和 Service。
|
||||
|
||||
如果你以 root 用户身份在环境中运行,
|
||||
请参见[使用 URL 打开仪表板](#open-dashboard-with-url)。
|
||||
要了解如何避免从终端直接调用浏览器并获取 Web 仪表板的 URL,请参阅
|
||||
"URL 复制和粘贴"选项卡。
|
||||
|
||||
默认情况下,仪表板只能从内部 Kubernetes 虚拟网络中访问。
|
||||
`dashboard` 命令创建一个临时代理,使仪表板可以从 Kubernetes 虚拟网络外部访问。
|
||||
|
@ -131,12 +131,12 @@ You can run the `dashboard` command again to create another proxy to access the
|
|||
{{% tab name="URL 复制粘贴" %}}
|
||||
|
||||
<!--
|
||||
If you don't want minikube to open a web browser for you, run the dashboard command with the
|
||||
If you don't want minikube to open a web browser for you, run the `dashboard` subcommand with the
|
||||
`--url` flag. `minikube` outputs a URL that you can open in the browser you prefer:
|
||||
|
||||
Open a **new** terminal, and run:
|
||||
-->
|
||||
如果你不想 Minikube 为你打开 Web 浏览器,可以使用 `--url` 标志运行仪表板命令。
|
||||
如果你不想 Minikube 为你打开 Web 浏览器,可以使用 `--url` 标志运行 `dashboard` 子命令。
|
||||
`minikube` 会输出一个 URL,你可以在你喜欢的浏览器中打开该 URL。
|
||||
|
||||
打开一个**新的**终端,然后运行:
|
||||
|
@ -147,9 +147,9 @@ minikube dashboard --url
|
|||
```
|
||||
|
||||
<!--
|
||||
Now, switch back to the terminal where you ran `minikube start`.
|
||||
Now, you can use this URL and switch back to the terminal where you ran `minikube start`.
|
||||
-->
|
||||
现在,切换回运行 `minikube start` 的终端。
|
||||
现在,你可以使用此 URL 并切换回运行 `minikube start` 的终端。
|
||||
|
||||
{{% /tab %}}
|
||||
{{< /tabs >}}
|
||||
|
@ -317,7 +317,7 @@ Kubernetes [*Service*](/docs/concepts/services-networking/service/).
|
|||
The output is similar to:
|
||||
-->
|
||||
|
||||
输出结果类似于这样:
|
||||
输出结果类似于这样:
|
||||
|
||||
```
|
||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||
|
|
|
@ -232,19 +232,23 @@ description: |-
|
|||
<div class="col-md-12">
|
||||
<!--
|
||||
<h3>View the app</h3>
|
||||
<p>Pods that are running inside Kubernetes are running on a private, isolated network.
|
||||
<p><a href="/docs/concepts/workloads/pods/">Pods</a> that are running inside Kubernetes are running on a private, isolated network.
|
||||
By default they are visible from other pods and services within the same kubernetes cluster,
|
||||
but not outside that network.
|
||||
When we use <code>kubectl</code>, we're interacting through an API endpoint to communicate with our application.</p>
|
||||
<p>We will cover other options on how to expose your application outside the Kubernetes
|
||||
cluster later, in <a href="/docs/tutorials/kubernetes-basics/expose/">Module 4</a>.</p>
|
||||
cluster later, in <a href="/docs/tutorials/kubernetes-basics/expose/">Module 4</a>.
|
||||
Also as a basic tutorial, we're not explaining what <code>Pods</code> are in any detail here, it will cover in later topics.</p>
|
||||
-->
|
||||
<h3>查看应用</h3>
|
||||
<p>在 Kubernetes 内运行的 Pod 运行在一个私有的、隔离的网络上。
|
||||
<p>在 Kubernetes 内运行的 <a href="/docs/concepts/workloads/pods/">Pod</a>
|
||||
运行在一个私有的、隔离的网络上。
|
||||
默认这些 Pod 可以从同一 Kubernetes 集群内的其他 Pod 和服务看到,但超出这个网络后则看不到。
|
||||
当我们使用 <code>kubectl</code> 时,我们通过 API 端点交互与应用进行通信。</p>
|
||||
<p>在 <a href="/zh-cn/docs/tutorials/kubernetes-basics/expose/">模块 4</a>
|
||||
中我们将讲述如何将应用暴露到 Kubernetes 集群外的其他选项。</p>
|
||||
中我们将讲述如何将应用暴露到 Kubernetes 集群外的其他选项。
|
||||
同样作为基础教程,我们不会在这里详细解释 <code>Pod</code> 是什么,后面的主题会介绍它。
|
||||
</p>
|
||||
|
||||
<!--
|
||||
<p>The <code>kubectl proxy</code> command can create a proxy that will forward communications
|
||||
|
|
|
@ -51,9 +51,9 @@ description: |-
|
|||
<!--
|
||||
<p>Kubernetes <a href="/docs/concepts/workloads/pods/">Pods</a> are mortal. Pods have a <a href="/docs/concepts/workloads/pods/pod-lifecycle/">lifecycle</a>. When a worker node dies, the Pods running on the Node are also lost. A <a href="/docs/concepts/workloads/controllers/replicaset/">ReplicaSet</a> might then dynamically drive the cluster back to the desired state via the creation of new Pods to keep your application running. As another example, consider an image-processing backend with 3 replicas. Those replicas are exchangeable; the front-end system should not care about backend replicas or even if a Pod is lost and recreated. That said, each Pod in a Kubernetes cluster has a unique IP address, even Pods on the same Node, so there needs to be a way of automatically reconciling changes among Pods so that your applications continue to function.</p>
|
||||
-->
|
||||
|
||||
<p> Kubernetes <a href="/zh-cn/docs/concepts/workloads/pods/">Pod</a> 是转瞬即逝的。 Pod 拥有 <a href="/zh-cn/docs/concepts/workloads/pods/pod-lifecycle/">生命周期</a>。
|
||||
当一个工作节点挂掉后, 在节点上运行的 Pod 也会消亡。 <a href="/zh-cn/docs/concepts/workloads/controllers/replicaset/">ReplicaSet</a> 会自动地通过创建新的 Pod 驱动集群回到目标状态,以保证应用正常运行。
|
||||
|
||||
<p> Kubernetes <a href="/zh-cn/docs/concepts/workloads/pods/">Pod</a> 是转瞬即逝的。 Pod 拥有 <a href="/zh-cn/docs/concepts/workloads/pods/pod-lifecycle/">生命周期</a>。
|
||||
当一个工作节点挂掉后, 在节点上运行的 Pod 也会消亡。 <a href="/zh-cn/docs/concepts/workloads/controllers/replicaset/">ReplicaSet</a> 会自动地通过创建新的 Pod 驱动集群回到目标状态,以保证应用正常运行。
|
||||
换一个例子,考虑一个具有 3 个副本的用作图像处理的后端程序。
|
||||
这些副本是可替换的。前端系统不应该关心后端副本,即使某个 Pod 丢失或被重新创建。
|
||||
此外,Kubernetes 集群中的每个 Pod 都有一个唯一的 IP 地址,即使是在同一个 Node 上的 Pod 也是如此,
|
||||
|
@ -177,8 +177,8 @@ description: |-
|
|||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<!-- <h3>Create a new Service</h3> -->
|
||||
<h3>创建新 Service</h3>
|
||||
<!-- <h3>Step 1: Creating a new Service</h3> -->
|
||||
<h3>第一步:创建新 Service</h3>
|
||||
<!--
|
||||
<p>Let’s verify that our application is running. We’ll use the <code>kubectl get</code> command and look for existing Pods:</p>
|
||||
-->
|
||||
|
@ -211,7 +211,7 @@ description: |-
|
|||
<p>To find out what port was opened externally (for the <tt>type: NodePort</tt> Service) we’ll run the <code>describe service</code> subcommand:</p>
|
||||
-->
|
||||
<p>我们现在有一个运行中的 Service 名为 kubernetes-bootcamp。
|
||||
这里我们看到 Service 收到了一个唯一的集群内 IP(cluster-IP),一个内部端口和一个外部 IP
|
||||
这里我们看到 Service 收到了一个唯一的集群内 IP(cluster-IP),一个内部端口和一个外部 IP
|
||||
(external-IP)(Node 的 IP)。</p>
|
||||
<p>要得到外部打开的端口号(对于 <tt>type: NodePort</tt> 的服务),我们需要运行 <code>describe service</code> 子命令:</p>
|
||||
<p><code><b>kubectl describe services/kubernetes-bootcamp</b></code></p>
|
||||
|
@ -239,7 +239,7 @@ description: |-
|
|||
-->
|
||||
{{< note >}}<p>如果你正在使用 Docker Desktop 作为容器驱动来运行 minikube, 需要使用 minikube tunnel。
|
||||
这是因为 Docker Desktop 内部的容器和宿主机是隔离的。<br>
|
||||
<p>在另一个终端窗口中,执行:<br>
|
||||
<p>在另一个终端窗口中,执行:<br>
|
||||
<code><b>minikube service kubernetes-bootcamp --url</b></code></p>
|
||||
<p>输出结果如下:
|
||||
<pre><b>http://127.0.0.1:51082<br>! Because you are using a Docker driver on darwin, the terminal needs to be open to run it.</b></pre></p>
|
||||
|
@ -300,12 +300,12 @@ description: |-
|
|||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<!-- <h3>Deleting a service</h3> -->
|
||||
<h3>删除一个 Service</h3>
|
||||
<!-- <h3>Step 3: Deleting a service</h3> -->
|
||||
<h3>第三步:删除一个 Service</h3>
|
||||
<!--
|
||||
<p>To delete Services you can use the <code>delete service</code> subcommand. Labels can be used also here:</p>
|
||||
-->
|
||||
<p>要删除一个 Service 你可以使用 <code>delete service</code> 子命令。这里也可以使用标签:</p>
|
||||
<p>要删除一个 Service 你可以使用 <code>delete service</code> 子命令。这里也可以使用标签:</p>
|
||||
<p><code><b>kubectl delete service -l app=kubernetes-bootcamp</b></code></p>
|
||||
<!--
|
||||
<p>Confirm that the Service is gone:</p>
|
||||
|
@ -340,7 +340,7 @@ description: |-
|
|||
<p>
|
||||
准备好之后,继续学习<a href="/zh-cn/docs/tutorials/kubernetes-basics/scale/scale-intro/" title="运行应用的多个实例">运行应用的多个实例</a>。
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -53,7 +53,7 @@ description: |-
|
|||
<p> <b> NOTE </b> If you are trying this after <a href="/docs/tutorials/kubernetes-basics/expose/expose-intro/">the previous section </a>, you may need to start from <a href="/docs/tutorials/kubernetes-basics/create-cluster/cluster-intro/">creating a cluster</a> as the services may have been deleted </p>
|
||||
-->
|
||||
<p><b>扩缩</b> 是通过改变 Deployment 中的副本数量来实现的。</p>
|
||||
<p> <b> 注意 </b> 如果你是在 <a href="/zh-cn/docs/tutorials/kubernetes-basics/expose/expose-intro/">上一节</a> 之后尝试此操作,
|
||||
<p> <b> 注意 </b> 如果你是在 <a href="/zh-cn/docs/tutorials/kubernetes-basics/expose/expose-intro/">上一节</a> 之后尝试此操作,
|
||||
你可能需要从 <a href="/zh-cn/docs/tutorials/kubernetes-basics/create-cluster/cluster-intro/">创建一个集群</a> 开始,
|
||||
因为 Service 可能已被删除。</p>
|
||||
|
||||
|
@ -61,7 +61,7 @@ description: |-
|
|||
<div class="col-md-4">
|
||||
<div class="content__box content__box_lined">
|
||||
<!-- <h3>Summary:</h3> -->
|
||||
<h3>小结:</h3>
|
||||
<h3>小结:</h3>
|
||||
<ul>
|
||||
<!-- <li>Scaling a Deployment</li> -->
|
||||
<li>扩缩一个 Deployment</li>
|
||||
|
@ -269,6 +269,28 @@ kubernetes-bootcamp 1/1 1 1 11m
|
|||
<p>We hit a different Pod with every request. This demonstrates that the load-balancing is working.</p>
|
||||
-->
|
||||
<p>我们每个请求都命中了不同的 Pod,这证明负载均衡正在工作。</p>
|
||||
{{< note >}}
|
||||
<!--
|
||||
<p>If you're running minikube with Docker Desktop as the container driver, a minikube tunnel is needed.
|
||||
This is because containers inside Docker Desktop are isolated from your host computer.<br>
|
||||
<p>In a separate terminal window, execute:<br>
|
||||
<code><b>minikube service kubernetes-bootcamp --url</b></code></p>
|
||||
-->
|
||||
<p>如果你使用 Docker Desktop 作为容器驱动程序运行 minikube,则需要 minikube 隧道。
|
||||
这是因为 Docker Desktop 内的容器与主机隔离。<br>
|
||||
<p>在单独的终端窗口中,执行:<br>
|
||||
<code><b>minikube service kubernetes-bootcamp --url</b></code></p>
|
||||
<!--
|
||||
<p>The output looks like this:
|
||||
<pre><b>http://127.0.0.1:51082<br>! Because you are using a Docker driver on darwin, the terminal needs to be open to run it.</b></pre></p>
|
||||
<p>Then use the given URL to access the app:<br>
|
||||
<code><b>curl 127.0.0.1:51082</b></code></p>
|
||||
-->
|
||||
<p>输出看起来像这样:
|
||||
<pre><b>http://127.0.0.1:51082<br>! Because you are using a Docker driver on darwin, the terminal needs to be open to run it.</b></pre></p>
|
||||
<p>然后使用给定的 URL 访问应用程序:
|
||||
<code><b>curl 127.0.0.1:51082</b></code></p>
|
||||
{{< /note >}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -137,16 +137,11 @@ It creates a [headless Service](/docs/concepts/services-networking/service/#head
|
|||
{{% code_sample file="application/web/web.yaml" %}}
|
||||
|
||||
<!--
|
||||
Download the example above, and save it to a file named `web.yaml`
|
||||
-->
|
||||
下载上面的例子并保存为文件 `web.yaml`。
|
||||
|
||||
<!--
|
||||
You will need to use two terminal windows. In the first terminal, use
|
||||
You will need to use at least two terminal windows. In the first terminal, use
|
||||
[`kubectl get`](/docs/reference/generated/kubectl/kubectl-commands/#get) to watch the creation
|
||||
of the StatefulSet's Pods.
|
||||
-->
|
||||
你需要使用两个终端窗口。在第一个终端中,使用
|
||||
你需要使用至少两个终端窗口。在第一个终端中,使用
|
||||
[`kubectl get`](/docs/reference/generated/kubectl/kubectl-commands/#get)
|
||||
来监视 StatefulSet 的 Pod 的创建情况。
|
||||
|
||||
|
@ -157,13 +152,13 @@ kubectl get pods -w -l app=nginx
|
|||
<!--
|
||||
In the second terminal, use
|
||||
[`kubectl apply`](/docs/reference/generated/kubectl/kubectl-commands/#apply) to create the
|
||||
headless Service and StatefulSet defined in `web.yaml`.
|
||||
headless Service and StatefulSet.
|
||||
-->
|
||||
在另一个终端中,使用 [`kubectl apply`](/docs/reference/generated/kubectl/kubectl-commands/#apply)
|
||||
来创建定义在 `web.yaml` 中的 Headless Service 和 StatefulSet。
|
||||
来创建 Headless Service 和 StatefulSet。
|
||||
|
||||
```shell
|
||||
kubectl apply -f web.yaml
|
||||
kubectl apply -f https://k8s.io/examples/application/web/web.yaml
|
||||
```
|
||||
```
|
||||
service/nginx created
|
||||
|
@ -1229,7 +1224,7 @@ update.
|
|||
<!--
|
||||
The partition is currently set to `2`. Set the partition to `0`:
|
||||
-->
|
||||
分区当前为 `2`。请将分区设置为 `0`:
|
||||
分区当前为 `2`,请将其设置为 `0`:
|
||||
|
||||
```shell
|
||||
kubectl patch statefulset web -p '{"spec":{"updateStrategy":{"type":"RollingUpdate","rollingUpdate":{"partition":0}}}}'
|
||||
|
@ -1415,7 +1410,7 @@ an error indicating that the Service already exists.
|
|||
Service(你不应该这样做),你将会看到一个错误,提示 Service 已经存在。
|
||||
|
||||
```shell
|
||||
kubectl apply -f web.yaml
|
||||
kubectl apply -f https://k8s.io/examples/application/web/web.yaml
|
||||
```
|
||||
```
|
||||
statefulset.apps/web created
|
||||
|
@ -1577,7 +1572,7 @@ Recreate the StatefulSet and headless Service one more time:
|
|||
再一次重新创建 StatefulSet 和 Headless Service:
|
||||
|
||||
```shell
|
||||
kubectl apply -f web.yaml
|
||||
kubectl apply -f https://k8s.io/examples/application/web/web.yaml
|
||||
```
|
||||
|
||||
```
|
||||
|
@ -1679,11 +1674,6 @@ Pod. This option only affects the behavior for scaling operations. Updates are n
|
|||
|
||||
{{{% code_sample file="application/web/web-parallel.yaml" %}}
|
||||
|
||||
<!--
|
||||
Download the example above, and save it to a file named `web-parallel.yaml`
|
||||
-->
|
||||
下载上面的例子并保存为 `web-parallel.yaml`。
|
||||
|
||||
<!--
|
||||
This manifest is identical to the one you downloaded above except that the `.spec.podManagementPolicy`
|
||||
of the `web` StatefulSet is set to `Parallel`.
|
||||
|
@ -1706,7 +1696,7 @@ In another terminal, create the StatefulSet and Service in the manifest:
|
|||
在另一个终端窗口创建清单中的 StatefulSet 和 Service:
|
||||
|
||||
```shell
|
||||
kubectl apply -f web-parallel.yaml
|
||||
kubectl apply -f https://k8s.io/examples/application/web/web-parallel.yaml
|
||||
```
|
||||
```
|
||||
service/nginx created
|
||||
|
|
Loading…
Reference in New Issue