
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
https://travis-ci.org/Mirantis/training-lab.svg?branch=master](https://travis-ci.org/Mirantis/training-lab)
使用本镜像需先安装Docker。
!Training lab - 架构图
!Ansible + Terraform + 云架构
| 服务 | IP / FQDN |
|---|---|
| DNS | 8.8.8.8, 1.1.1.1 |
| NTP | 0.pool.ntp.org, 1.pool.ntp.org |
| 描述 | 用途 | vxlan id | CIDR | 网关 |
|---|---|---|---|---|
| 管理网络(MGMT) | 管理、PXE引导新裸金属服务器(Salt) | 10 | 10.0.0.0/24 | 10.0.0.241 |
| 控制平面网络(Control) | MCP内部(Salt、服务、API、SDN) | 11 | 10.0.1.0/24 | 10.0.1.241 |
| 公共网络(Proxy) | 用户面向(Web UI、API端点) | 12 | 10.0.2.0/24 | 10.0.2.241 |
| 数据网络 | SDN数据平面(可选,推荐) | 13 | 10.0.3.0/24 | 10.0.3.241 |
| 存储网络(前端/访问) | SDS前端 | 14 | 10.0.4.0/24 | 10.0.4.241 |
| 存储网络(后端/复制) | SDS复制(可选) | 15 | 10.0.5.0/24 | 10.0.5.241 |
| 节点类型 | 主机名 | mgmt网络MAC | FQDN | 公共FQDN | 角色/描述 | 云IP | 管理IP (br-mgm) | 控制IP (br-ctl) | 公共/代理IP (br-public) | 数据平面IP (br-data) | SDS前端IP (br-storage) | SDS复制IP (br-storrepl) | 类型 [VM, 嵌套VM] | 放置位置 | 内存 | 硬盘 | CPU |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| kvm01 | kvm01 | ??? | kvm01.tng.mirantis.com | ???-kvm01.??.tng.mirantis.com | MCP基础设施 | 192.168.250.241 | 10.0.0.241 | 10.0.1.241 | 10.0.2.241 | 10.0.3.241 | 10.0.4.241 | 10.0.5.241 | VM | none | 64 | 128 | 16 |
| kvm | kvm02 | ??? | kvm02.tng.mirantis.com | ???-kvm02.??.tng.mirantis.com | MCP基础设施 | 192.168.250.242 | 10.0.0.242 | 10.0.1.242 | 10.0.2.242 | 10.0.3.242 | 10.0.4.242 | 10.0.5.242 | VM | none | 64 | 128 | 16 |
| kvm | kvm03 | ??? | kvm03.tng.mirantis.com | ???-kvm03.??.tng.mirantis.com | MCP基础设施 | 192.168.250.243 | 10.0.0.243 | 10.0.1.243 | 10.0.2.243 | 10.0.3.243 | 10.0.4.243 | 10.0.5.243 | VM | none | 64 | 128 | 16 |
| cfg01 | cfg03 | ??? | cfg01.tng.mirantis.com | none | MCP基础设施 | none | 10.0.0.15 | 10.0.1.15 | none | none | none | none | 嵌套VM | kvm01 | 8 | 50 | 4 |
| cmp01 | cmp01 | ??? | cmp01.tng.mirantis.com | none | 计算节点(KVM) | 192.168.250.231 | 10.0.0.231 | 10.0.1.231 | 10.0.2.231 | 10.0.3.231 | 10.0.4.231 | 10.0.5.231 | VM | none | 8 | 16 | 2 |
| osd01 | osd01 | ??? | osd01.tng.mirantis.com | none | Ceph OSD节点 | 192.168.250.221 | 10.0.0.221 | 10.0.1.221 | 10.0.2.221 | 10.0.3.221 | 10.0.4.221 | 10.0.5.221 | VM | none | 4 | 20 | 2 |
| pxe | kvm01-pxe01 | 52:54:00:00:01:01 | kvm01-pxe01 | none | PXE MAAS测试 | none | MAAS DHCP | none | none | none | none | none | 嵌套VM | kvm01 | 2 | 5 | 1 |
| pxe | kvm02-pxe01 | 52:54:00:00:02:01 | kvm02-pxe01 | none | PXE MAAS测试 | none | MAAS DHCP | none | none | none | none | none | 嵌套VM | kvm02 | 2 | 5 | 1 |
| pxe | kvm03-pxe01 | 52:54:00:00:03:01 | kvm03-pxe01 | none | PXE MAAS测试 | none | MAAS DHCP | none | none | none | none | none | 嵌套VM | kvm03 | 2 | 5 | 1 |
以下是使用预构建Docker镜像在Azure中构建培训环境的说明。Docker镜像包含az、https://www.terraform.io/%E5%92%8Chttps://www.ansible.com/%E5%B7%A5%E5%85%B7%E3%80%82
新Azure账户只需执行一次:
https://www.terraform.io/docs/providers/azurerm/authenticating_via_service_principal.html
[***]
bashecho "*** 登录Azure CLI" az login echo "*** 获取默认订阅的订阅ID" SUBSCRIPTION_ID=$(az account list | jq -r '.[] | select (.isDefault == true).id') echo "*** 创建具有指定订阅资源管理权限的服务主体" az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/$SUBSCRIPTION_ID" echo "*** 使用服务主体登录Azure并验证" az login --service-principal -u 0xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -p fxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --tenant 0xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx az vm list-sizes --location westus
详情参见:[***]
bash# 创建资源组 $ az group create --name training-lab-dns --location "East US 2" $ az network dns zone create -g training-lab-dns -n tng.mirantis.com # 列出Azure中tng.mirantis.com区域的DNS名称服务器 # 需联系域名所有者将"tng.mirantis.com"区域委托给Azure名称服务器 $ az network dns zone show -g training-lab-dns -n tng.mirantis.com -o json # 检查DNS服务器是否将查询转发到Azure DNS服务器 $ dig +short -t SOA tng.mirantis.com ns1-04.azure-dns.com. azuredns-hostmaster.microsoft.com. 1 3600 300 2419200 300 # 添加默认"www" CNAME到training.mirantis.com $ az network dns record-set cname set-record -g training-lab-dns -z tng.mirantis.com -n www -c training.mirantis.com
构建自定义镜像可加速部署过程。详情参见:https://www.packer.io/docs/builders/azure-setup.html 和 https://github.com/hashicorp/packer/blob/master/contrib/azure-setup.sh
bash# 创建资源组 az group create --name training-lab-images --location "East US 2" echo "*** 创建应用" az ad app create --display-name "packerbuild" --identifier-uris http://packerbuild --homepage http://packerbuild --password my_packer_password # 修改密码:az ad app update --id $(az ad app list | jq -r '.[] | select (.displayName == "packerbuild").appId') --password fxxxxxxxxxxxxxxf echo "*** 获取应用ID" CLIENT_ID=$(az ad app list | jq -r '.[] | select (.displayName == "packerbuild").appId') echo "*** 创建服务主体" az ad sp create --id $CLIENT_ID echo "*** 获取服务主体ID" OBJECT_ID=$(az ad sp list | jq -r '.[] | select (.displayName == "packerbuild").objectId') echo "*** 获取默认订阅的订阅ID" SUBSCRIPTION_ID=$(az account list | jq -r '.[] | select (.isDefault == true).id') echo "*** 创建权限" az role assignment create --assignee $OBJECT_ID --role "Owner" --scope /subscriptions/$SUBSCRIPTION_ID
标准部署过程需从互联网下载大量包、镜像和仓库,耗时较长。为加速部署,可构建适用于OpenStack/Azure/本地测试的自定义镜像。
bashexport AZURE_CLIENT_ID="$(az ad app list | jq -r '.[] | select (.displayName == "packerbuild").appId')" export AZURE_CLIENT_SECRET="my_packer_password" export AZURE_RESOURCE_GROUP_NAME="training-lab-images" export AZURE_SUBSCRIPTION_ID="$(az account list | jq -r '.[] | select (.isDefault == true).id')" NAME=training-lab_kvm-ubuntu-16.04-server-amd64 packer build -only=azure-arm training-lab_ubuntu_image.json NAME=training-lab_kvm01-ubuntu-16.04-server-amd64 packer build -only=azure-arm training-lab_ubuntu_image.json
更多详情请查看packer目录。
执行以下命令在最新Ubuntu上安装必要依赖:
bash# 可使用Docker镜像: # docker run -e "USER=$USER" --privileged --rm -it ubuntu:latest sudo apt update -qq sudo apt install -y curl docker.io git openssh-client sudo # 如需修改默认Docker网络 cat > /etc/docker/daemon.json << EOF { "bip": "192.168.150.1/24", "fixed-cidr": "192.168.150.0/24" } EOF sudo service docker start test -f $HOME/.ssh/id_rsa || ( install -m 0700 -d $HOME/.ssh && ssh-keygen -b 2048 -t rsa -f $HOME/.ssh/id_rsa -q -N "" ) git clone https://github.com/Mirantis/training-lab.git read -s -p "Training Lab的Ansible Vault密码: " MY_ANSIBLE_VAULT_TRAINIG_LAB_PASSWORD echo "$MY_ANSIBLE_VAULT_TRAINIG_LAB_PASSWORD" > training-lab/ansible/vault_training-lab.txt cd training-lab/ansible # 创建OpenStack培训环境 ./create_openstack.sh # 删除整个OpenStack结构 ./delete_openstack.sh 或 # 创建Azure培训环境 ./create_azure.sh # 删除整个Azure结构 ./delete_azure.sh
https://asciinema.org/a/***.png](https://asciinema.org/a/***)
[***]"创建控制平面VM"开始)
bash# 查看cfg01控制台 $ virsh console cfg01.tng.mirantis.com # 或安装完成后通过SSH连接cfg01 $ ssh root@cfg01 # 检查安装过程是否成功完成(应以"reboot"结束) $ tail -1 /var/log/cloud-init-output.log + reboot # 验证所有Salt Minion节点已在Salt Master节点上注册 $ salt-key Accepted Keys: cfg01.tng.mirantis.com cmp01.tng.mirantis.com kvm01.tng.mirantis.com kvm02.tng.mirantis.com kvm03.tng.mirantis.com Denied Keys: Unaccepted Keys: Rejected Keys: # 检查Salt版本 $ salt '*' test.version cfg01.tng.mirantis.com: 2017.7.5 cmp01.tng.mirantis.com: 2017.7.5 kvm01.tng.mirantis.com: 2017.7.5 kvm02.tng.mirantis.com: 2017.7.5 kvm03.tng.mirantis.com: 2017.7.5 # 在Salt Master节点上验证Salt Minion节点是否同步 $ salt '*' saltutil.sync_all # 检查清单以解决模型中的不一致 $ reclass-salt --top # 验证cloud-init执行期间以下状态是否成功应用 $ salt-call state.sls linux.system,linux,openssh,salt $ salt-call state.sls maas.cluster,maas.region,reclass # 用服务器配置MAAS $ salt-call state.sls maas.machines #https://github.com/Mirantis/pipeline-library/blob/master/src/com/mirantis/mk/Orchestrate.groovy#L115
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务