资源编排教程列举了示例模板场景实践典型场景。
本章节介绍如何使用资源栈示例模板ZStack.System.v1.VxlanVPC一键部署VXLAN类型的VPC网络。
本实践直接使用示例模板创建资源栈。
{ "ZStackTemplateFormatVersion": "2018-06-18", "Description": "Creates Vxlan VPC network. This template creates a VPC network. Make sure that the public network and management network are working as expected. Note that the VXLAN VTEP CIDR is required.", "Parameters": { "VrouterImageUrl": { "Type": "String", "Label":"Vrouter image", "Description":"vRtouter image URL", "DefaultValue": "http://cdn.zstack.io/product_downloads/vrouter/3.8.4/r5ed93wpjf/zstack-vrouter-3.8.4.qcow2" }, "VmImageUrl": { "Type": "String", "Label": "VM image url", "Description":"VM image url", "DefaultValue": "http://cdn.zstack.io/zstack_repo/latest/zstack-image-1.4.qcow2" }, "BackupStorage":{ "Type": "CommaDelimitedList", "Label": "BackupStorage UUID", "Description":"BackStorage UUID" }, "ManagementNetworkUuid":{ "Type": "String", "Label": "Management network", "Description":"You can use public network as management network" }, "PublicNetworkUuid":{ "Type": "String", "Label": "Public network", "Description":"Public network UUID" }, "ZoneUuid":{ "Type": "String", "Label": "Zone", "Description":"Zone UUID" }, "ClusterUuid":{ "Type": "String", "Label": "Cluster", "Description":"Cluster UUID" }, "Cidr":{ "Type": "String", "Description":"VTEP CIDR. Use the correct CIDR", "DefaultValue":"{10.0.0.0/8}" }, "Vni":{ "Type": "Number", "DefaultValue":222 }, "StartVni":{ "Type": "Number", "DefaultValue":100 }, "EndVni":{ "Type": "Number", "DefaultValue":300 }, "StartIp":{ "Type": "String", "DefaultValue":"192.168.20.2" }, "EndIp":{ "Type": "String", "DefaultValue":"192.168.20.200" }, "Netmask":{ "Type": "String", "DefaultValue":"255.255.255.0" }, "Gateway":{ "Type": "String", "DefaultValue":"192.168.20.1" } }, "Resources": { "VrouterImage": { "Type": "ZStack::Resource::Image", "Properties": { "name": {"Fn::Join":["-",[{"Ref":"ZStack::StackName"}, {"Ref":"ZStack::StackUuid"},{"Ref":"ZStack::AccountUuid"},{"Ref":"ZStack::AccountName"},"Vrouter-Image"]]}, "url": {"Ref":"VrouterImageUrl"}, "system": true, "format": "qcow2", "backupStorageUuids":{"Ref":"BackupStorage"} } }, "VMImage": { "Type": "ZStack::Resource::Image", "Properties": { "name": {"Fn::Join":["-",[{"Ref":"ZStack::StackName"}, "VmImage"]]}, "url": {"Ref":"VmImageUrl"}, "format": "qcow2", "backupStorageUuids":{"Ref":"BackupStorage"} } }, "VirtualRouterOffering":{ "Type":"ZStack::Resource::VirtualRouterOffering", "Properties":{ "name": {"Fn::Join":["-",[{"Ref":"ZStack::StackName"}, "Vrouter-Offering"]]}, "zoneUuid":{"Ref":"ZoneUuid"}, "managementNetworkUuid":{"Ref":"ManagementNetworkUuid"}, "publicNetworkUuid":{"Ref":"PublicNetworkUuid"}, "imageUuid":{"Fn::GetAtt":["VrouterImage", "uuid"]}, "cpuNum":2, "memorySize":2147483648 } }, "VpcVRouter":{ "Type":"ZStack::Resource::VpcVRouter", "Properties":{ "name": {"Fn::Join":["-",[{"Ref":"ZStack::StackName"}, "VPC-Router"]]}, "virtualRouterOfferingUuid":{"Fn::GetAtt":["VirtualRouterOffering","uuid"]} } }, "L2VxlanNetworkPool":{ "Type":"ZStack::Resource::L2VxlanNetworkPool", "Properties":{ "name": {"Fn::Join":["-",[{"Ref":"ZStack::StackName"}, "L2VxlanNetworkPool"]]}, "zoneUuid":{"Ref":"ZoneUuid"} } }, "VniRange":{ "Type":"ZStack::Resource::VniRange", "Properties":{ "name": {"Fn::Join":["-",[{"Ref":"ZStack::StackName"}, "VniRange"]]}, "startVni":{"Ref":"StartVni"}, "endVni":{"Ref":"EndVni"}, "l2NetworkUuid":{"Fn::GetAtt":["L2VxlanNetworkPool","uuid"]} } }, "L2VxlanNetwork":{ "Type":"ZStack::Resource::L2VxlanNetwork", "Properties":{ "name": {"Fn::Join":["-",[{"Ref":"ZStack::StackName"}, "L2VxlanNetwork"]]}, "poolUuid":{"Fn::GetAtt":["L2VxlanNetworkPool","uuid"]}, "zoneUuid":{"Ref":"ZoneUuid"}, "vni":{"Ref":"Vni"} } }, "VpcL3Network":{ "Type":"ZStack::Resource::L3Network", "Properties":{ "name": {"Fn::Join":["-",[{"Ref":"ZStack::StackName"}, "VPC-Network"]]}, "l2NetworkUuid":{"Fn::GetAtt":["L2VxlanNetwork","uuid"]}, "category":"Private", "type":"L3VpcNetwork", "systemTags":["networkservices::VRouter"] } }, "AttachL3ToVm":{ "Type":"ZStack::Action::AttachL3NetworkToVm", "Properties":{ "vmInstanceUuid": {"Fn::GetAtt":["VpcVRouter","uuid"]}, "l3NetworkUuid":{"Fn::GetAtt":["VpcL3Network","uuid"]} }, "DependsOn":[{"Ref":"AddIpRange"}] }, "AddIpRange" :{ "Type":"ZStack::Action::AddIpRange", "Properties":{ "name": {"Fn::Join":["-",[{"Ref":"ZStack::StackName"}, "iprange"]]}, "l3NetworkUuid":{"Fn::GetAtt":["VpcL3Network","uuid"]}, "startIp":{"Ref":"StartIp"}, "endIp":{"Ref":"EndIp"}, "netmask":{"Ref":"Netmask"}, "gateway":{"Ref":"Gateway"} } }, "AttachL2NetworkToCluster":{ "Type":"ZStack::Action::AttachL2NetworkToCluster", "Properties":{ "l2NetworkUuid":{"Fn::GetAtt":["L2VxlanNetworkPool","uuid"]}, "clusterUuid":{"Ref":"ClusterUuid"}, "systemTags":[{"Fn::Join":["::",["l2NetworkUuid",{"Fn::GetAtt":["L2VxlanNetwork","uuid"]},"clusterUuid",{"Ref":"ClusterUuid"},"cidr",{"Ref":"Cidr"}]]}] } }, "TestVm":{ "Type":"ZStack::Resource::VmInstance", "Properties":{ "name": {"Fn::Join":["-",[{"Ref":"ZStack::StackName"}, "TestVm"]]}, "cpuNum": 1, "memorySize": 1073741824, "l3NetworkUuids": [{"Fn::GetAtt":["VpcL3Network","uuid"]}], "imageUuid": {"Fn::GetAtt":["VMImage", "uuid"]} }, "DependsOn":[{"Ref":"AttachL3ToVm"}] } }, "Outputs": { "vpc": { "Value": { "Ref": "VpcL3Network" } } } }
"ZStackTemplateFormatVersion": "2018-06-18"
定义模板版本。
"Description": "Creates Vxlan VPC network. This template creates a VPC network. Make sure that the public network and management network are working as expected. Note that the VXLAN VTEP CIDR is required."
定义对模板的解释说明。
"Parameters": { }
定义模板的参数列表。
"Resources": { }
定义该模板将要创建的资源。
"Parameters": { }
中定义的参数。"Outputs": { }
定义资源创建完成后,通过资源栈输出资源属性等有用信息。
关于模板语法的详细介绍,请参考资源栈模板语法章节。
本场景介绍如何使用可视化编辑器快速部署VPC网路场景下的三层Web服务分离。
例如,可将Web云主机、应用云主机、数据库云主机分别部署在不同的网络层面,从而保证网络安全。
路由器名称 | 二层网络 | VPC网络 | IP地址段 |
---|---|---|---|
VPC路由器 | L2Network-1 | Web网络 | 192.168.0.0/24 |
应用网络 | 192.168.100.0/24 | ||
数据库网络 | 192.168.200.0/24 |
云主机名称 | 所属网络 | IP地址 |
---|---|---|
Web云主机 | Web网络 | 192.168.0.100 |
应用云主机 | 应用网络 | 192.168.100.100 |
数据库云主机 | 数据库网络 | 192.168.200.100 |
在ZStack Cloud主菜单,点击 ,进入可视化编排界面,从左侧资源列表拖拽二层网络、VPC网络、VPC路由器和云主机到画布。
至此,可视化编辑器快速部署VPC网路场景下的三层Web服务分离介绍完毕。
学习路径
ZStack Cloud 产品学习路径
快速梳理文档,点击相应文本链接,快速跳转到相应文档的页面,学习 ZStack Cloud 产品。
业务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2其他(漏洞提交、投诉举报等)
400-962-2212 转 3业务咨询:
400-962-2212 转 1ZStack学院:
training@zstack.io业务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2其他(漏洞提交、投诉举报等)
400-962-2212 转 3业务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2其他(漏洞提交、投诉举报等)
400-962-2212 转 3业务咨询:
400-962-2212 转 1商务联系:
channel@zstack.io业务咨询:
400-962-2212 转 1商务联系:
channel@zstack.io下载链接已发送至您的邮箱。
如未收到,请查看您的垃圾邮件、订阅邮件、广告邮件。 当您收到电子邮件后,请点击 URL 链接,以完成下载。感谢您使用 ZStack 产品和服务。
成功提交申请。
我们将安排工作人员尽快与您取得联系。感谢您使用 ZStack 产品和服务。
信息提交成功。
我们将安排工作人员尽快与您取得联系,请保持电话畅通。感谢您使用 ZStack 产品和服务。
商务咨询:
400-962-2212 转 1售后咨询:
400-962-2212 转 2商务联系:
sales@zstack.io成功提交申请。
我们将安排工作人员尽快与您取得联系。感谢您使用 ZStack 产品和服务。