Archiving the v2.6/v2.7 zh docs. Updating the zh sidebar version JSON files to reflect archived messaging in navigation dropdown.

Signed-off-by: Sunil Singh <sunil.singh@suse.com>
This commit is contained in:
Sunil Singh
2025-06-11 16:10:14 -07:00
parent 5069378133
commit af77fc8954
1047 changed files with 28 additions and 1572 deletions
@@ -0,0 +1,12 @@
---
title: 部署工作负载
---
<head>
<link rel="canonical" href="https://ranchermanager.docs.rancher.com/zh/getting-started/quick-start-guides/deploy-workloads"/>
</head>
这些指南指导你完成一个应用的部署,包括如何将应用暴露在集群之外使用。
- [部署带有 Ingress 的工作负载](workload-ingress.md)
- [部署带有 NodePort 的工作负载](nodeports.md)
@@ -0,0 +1,138 @@
---
title: 部署带有 NodePort 的工作负载
---
### 先决条件
你已有一个正在运行的集群,且该集群中有至少一个节点。
### 1. 部署工作负载
你可以开始创建你的第一个 Kubernetes [工作负载](https://kubernetes.io/docs/concepts/workloads/)。工作负载是一个对象,其中包含 pod 以及部署应用所需的其他文件和信息。
在本文的工作负载中,你将部署一个 Rancher Hello-World 应用。
1. 点击 **☰ > 集群管理**。
1. 在**集群**页面中,进入需要部署工作负载的集群,然后单击 **Explore**
1. 点击**工作负载**。
1. 单击**创建**。
1. 为工作负载设置**名称**。
1. 在**容器镜像**字段中,输入 `rancher/hello-world`。注意区分大小写。
1. 点击**添加端口**。
1. 在**服务类型**下拉菜单中,确保选择了 **NodePort**
![NodePort 下拉菜单(在每个所选节点处)](/img/nodeport-dropdown.png)
1. 在**发布容器端口**字段中,输入端口`80`
![发布容器端口,端口 80 已输入](/img/container-port-field.png)
1. 单击**创建**。
**结果**
* 工作负载已部署。此过程可能需要几分钟。
* 当工作负载完成部署后,它的状态会变为 **Active**。你可以从项目的**工作负载**页面查看其状态。
<br/>
### 2. 查看应用
在**工作负载**页面中,点击工作负载下方的链接。如果 deployment 已完成,你的应用会打开。
### 注意事项
如果使用云虚拟机,你可能无法访问运行容器的端口。这种情况下,你可以使用 `Execute Shell` 在本地主机的 SSH 会话中测试 Nginx。如果可用的话,使用工作负载下方的链接中 `:` 后面的端口号。在本例中,端口号为 `31568`
```html
gettingstarted@rancher:~$ curl http://localhost:31568
<!DOCTYPE html>
<html>
<head>
<title>Rancher</title>
<link rel="icon" href="img/favicon.png">
<style>
body {
background-color: white;
text-align: center;
padding: 50px;
font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
}
button {
background-color: #0075a8;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
#logo {
margin-bottom: 40px;
}
</style>
</head>
<body>
<img id="logo" src="img/rancher-logo.svg" alt="Rancher logo" width=400 />
<h1>Hello world!</h1>
<h3>My hostname is hello-world-66b4b9d88b-78bhx</h3>
<div id='Services'>
<h3>k8s services found 2</h3>
<b>INGRESS_D1E1A394F61C108633C4BD37AEDDE757</b> tcp://10.43.203.31:80<br />
<b>KUBERNETES</b> tcp://10.43.0.1:443<br />
</div>
<br />
<div id='rancherLinks' class="row social">
<a class="p-a-xs" href="https://rancher.com/docs"><img src="img/favicon.png" alt="Docs" height="25" width="25"></a>
<a class="p-a-xs" href="https://slack.rancher.io/"><img src="img/icon-slack.svg" alt="slack" height="25" width="25"></a>
<a class="p-a-xs" href="https://github.com/rancher/rancher"><img src="img/icon-github.svg" alt="github" height="25" width="25"></a>
<a class="p-a-xs" href="https://twitter.com/Rancher_Labs"><img src="img/icon-twitter.svg" alt="twitter" height="25" width="25"></a>
<a class="p-a-xs" href="https://www.facebook.com/rancherlabs/"><img src="img/icon-facebook.svg" alt="facebook" height="25" width="25"></a>
<a class="p-a-xs" href="https://www.linkedin.com/groups/6977008/profile"><img src="img/icon-linkedin.svg" height="25" alt="linkedin" width="25"></a>
</div>
<br />
<button class='button' onclick='myFunction()'>Show request details</button>
<div id="reqInfo" style='display:none'>
<h3>Request info</h3>
<b>Host:</b> 172.22.101.111:31411 <br />
<b>Pod:</b> hello-world-66b4b9d88b-78bhx </b><br />
<b>Accept:</b> [*/*]<br />
<b>User-Agent:</b> [curl/7.47.0]<br />
</div>
<br />
<script>
function myFunction() {
var x = document.getElementById("reqInfo");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
</script>
</body>
</html>
gettingstarted@rancher:~$
```
### 已完成!
恭喜!你已成功通过 NodePort 部署工作负载。
#### 后续操作
使用完沙盒后,你需要清理 Rancher Server 和集群。详情请参见:
- [Amazon AWS:销毁环境](../deploy-rancher-manager/aws.md#销毁环境)
- [DigitalOcean:销毁环境](../deploy-rancher-manager/digitalocean.md#销毁环境)
- [Vagrant:销毁环境](../deploy-rancher-manager/vagrant.md#销毁环境)
@@ -0,0 +1,72 @@
---
title: 部署带有 Ingress 的工作负载
---
### 先决条件
你已有一个正在运行的集群,且该集群中有至少一个节点。
### 1. 部署工作负载
你可以开始创建你的第一个 Kubernetes [工作负载](https://kubernetes.io/docs/concepts/workloads/)。工作负载是一个对象,其中包含 pod 以及部署应用所需的其他文件和信息。
在本文的工作负载中,你将部署一个 Rancher Hello-World 应用。
1. 点击 **☰ > 集群管理**。
1. 选择你创建的集群,并点击 **Explore**
1. 点击**工作负载**。
1. 单击**创建**。
1. 点击 **Deployment**
1. 为工作负载设置**名称**。
1. 在**容器镜像**字段中,输入 `rancher/hello-world`。注意区分大小写。
1.`Service Type` 点击 **Add Port**`Cluster IP`,并在 **Private Container Port** 字段中输入`80`。你可以将 `Name` 留空或指定名称。通过添加端口,你可以访问集群内外的应用。有关详细信息,请参阅 [Service](../../../pages-for-subheaders/workloads-and-pods.md#services)。
1. 单击**创建**。
**结果**
* 工作负载已部署。此过程可能需要几分钟。
* 当工作负载完成部署后,它的状态会变为 **Active**。你可以从项目的**工作负载**页面查看其状态。
### 2. 通过 Ingress 暴露应用
现在应用已启动并运行,你需要暴露应用以让其他服务连接到它。
1. 点击 **☰ > 集群管理**。
1. 选择你创建的集群,并点击 **Explore**
1. 点击**服务发现 > Ingresses**。
1. 点击**创建**。
1. 在选择**命名空间**时,你需要选择在创建 deployment 时使用的命名空间。否则,在步骤8中选择**目标服务**时,你的 deployment 会不可用。
1. 输入**名称**,例如 **hello**
1. 指定**路径**,例如 `/hello`
1. 在**目标服务**字段的下拉菜单中,选择你为服务设置的名称。
1. 在**端口**字段中的下拉菜单中,选择 `80`
1. 点击右下角的**创建**。
**结果**:应用分配到了一个 `sslip.io` 地址并暴露。这可能需要一两分钟。
### 查看应用
**Deployments** 页面中,找到你 deployment 的 **endpoint** 列,然后单击一个 endpoint。可用的 endpoint 取决于你添加到 deployment 中的端口配置。如果你看不到随机分配端口的 endpoint,请将你在创建 Ingress 时指定的路径尾附到 IP 地址上。例如,如果你的 endpoint 是 `xxx.xxx.xxx.xxx``https://xxx.xxx.xxx.xxx`,把它修改为 `xxx.xxx.xxx.xxx/hello``https://xxx.xxx.xxx.xxx/hello`
应用将在另一个窗口中打开。
#### 已完成!
恭喜!你已成功通过 Ingress 部署工作负载。
#### 后续操作
使用完沙盒后,你需要清理 Rancher Server 和集群。详情请参见:
- [Amazon AWS:销毁环境](../deploy-rancher-manager/aws.md#销毁环境)
- [DigitalOcean:销毁环境](../deploy-rancher-manager/digitalocean.md#销毁环境)
- [Vagrant:销毁环境](../deploy-rancher-manager/vagrant.md#销毁环境)