> For the complete documentation index, see [llms.txt](https://docs.verge.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verge.io/learn-the-platform/zh/mo-kuai-7-duo-zu-hu/lab.md).

# 实验：多租户环境

## 目标

在 VergeOS 中设计并部署多租户环境，包括手动创建租户、基于配方的租户预配，以及在网络层和存储层验证租户隔离。

## 前置条件

* 已完成模块 1：架构基础
* 已完成第 4 模块：网络
* 已完成第 5 模块：存储
* 已完成第 6 模块：虚拟机
* 已完成第 7 模块阅读（多租户概念、租户创建、租户配方、隔离与安全）
* 一个正在运行的 VergeOS 集群，具备足够的计算、内存和存储资源，可支持至少 2 个租户

## 难度

**中级** -- 需要理解资源分配、网络和虚拟化概念

## 预计时间

**1.5 小时**

## 步骤

### 第 1 部分：手动创建租户

从零创建一个租户并配置其资源。

1. 导航到 VergeOS UI 中的租户部分
2. 创建一个具有以下配置的新租户：
   * 名称：“lab-tenant-01”
   * CPU 核心数：4
   * 内存：8 GB
   * 存储：100 GB
3. 配置租户网络：
   * 为租户创建一个内部网络
   * 配置外部网络访问（NAT 或直连，取决于你的环境）
4. 登录租户 UI 并验证已分配的资源是否可见
5. 在租户内部创建一个简单的虚拟机，以确认计算和存储正常工作

### 第 2 部分：租户配方部署

使用预构建的配方部署租户，以实现标准化预配。

1. 查看 VergeOS 配方目录中可用的租户配方
2. 选择或创建一个包含以下内容的租户配方：
   * 预定义的资源分配（CPU、内存、存储）
   * 预配置的内部网络
   * 一个或多个 VM 模板
3. 从该配方部署一个新租户：
   * 名称：“lab-tenant-02”
   * 审查并接受配方定义的配置
4. 登录通过配方部署的租户并验证：
   * 资源与配方规范一致
   * 预配置的 VM 和网络已存在
5. 比较通过配方部署的租户与手动创建的租户

### 第 3 部分：租户隔离验证

确认租户彼此之间以及与主机环境之间是正确隔离的。

1. 从“lab-tenant-01”尝试访问“lab-tenant-02”中的资源：
   * 尝试 ping 另一租户网络中的 VM
   * 验证跨租户网络流量被阻止
2. 从主机（提供方）环境中验证：
   * 两个租户都可见且可管理
   * 租户资源已计入主机资源使用情况
3. 测试资源边界：
   * 尝试在租户中超出分配的存储配额
   * 注意：存储配额是 **软限制** —— 系统在接近阈值时会生成日志告警，但写入在精确边界处不会立即被硬性阻止；当你接近限制时，请观察生成的告警
4. 从主机环境中查看租户日志和审计轨迹

## 验证

当你能够回答以下内容时，你的多租户实验即告完成 **是** 时，你的 VMware 迁移实验就完成了：

* [ ] 已手动创建一个指定 CPU、内存、存储和网络的租户
* [ ] 已在手动创建的租户中创建并成功运行一个 VM
* [ ] 已从配方部署一个具有正确预配置资源的租户
* [ ] 已验证租户之间的网络隔离（跨租户流量被阻止）
* [ ] 已测试并强制执行资源限制
* [ ] 两个租户都可从主机（提供方）环境中进行管理


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.verge.io/learn-the-platform/zh/mo-kuai-7-duo-zu-hu/lab.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
