前提条件
Azure 订阅
Section titled “Azure 订阅”需要一个有效的 Azure 订阅,并具有创建以下资源的权限:
- 资源组
- 虚拟网络和子网
- 网络安全组
- 公共 IP 地址
- 虚拟机(Standard_D16s_v3 — 16 vCPU,64 GiB RAM,适用于 41 容器工作负载)
Azure CLI
Section titled “Azure CLI”安装并验证 Azure CLI:
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
az login
az account show --query '{name:name, id:id}' -o tableTerraform
Section titled “Terraform”需要 Terraform >= 1.5:
terraform version如未安装,请使用 HashiCorp APT 存储库:
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpgecho "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.listsudo apt update && sudo apt install terraformAzure AD 权限
Section titled “Azure AD 权限”您的 Azure AD 账户必须具有 User.Read 权限。部署者标识符(用于资源命名)将自动从您的 Azure AD 配置文件中派生。如使用服务主体或托管标识进行身份验证,请显式设置 deployer Terraform 变量。
SSH 密钥对
Section titled “SSH 密钥对”用于虚拟机访问的 SSH 密钥对:
ssh-keygen -t ed25519 -f ~/.ssh/origin-server-key -N ""已创建的 Azure 资源
Section titled “已创建的 Azure 资源”| 资源 | SKU |
|---|---|
| Ubuntu 24.04 虚拟机 | Standard_D16s_v3(16 vCPU,64 GiB) |
| 公共 IP | 标准,静态 |
| 系统磁盘 | 60 GiB 高级 SSD |
| VNet + NSG | 默认 |
请参阅 Azure 定价计算器 了解当前费用。在实验室不使用时,请执行 terraform destroy 以停止计费。具体操作步骤请参阅销毁环境。