自定义网络


1.创建隔离网络

在TripleO的默认部署中,所有的网络流量都走Provisioning Network。那能不能把每种类型的网络分离出来?当然可以!

TripleO网络中有以下网络类型:

  1. Network 1 - Provisioning
  2. Network 2 - Internal API
  3. Network 3 - Tenant Networks
  4. Network 4 - Storage
  5. Network 5 - Storage Management
  6. Network 7 - External and Floating IP (mapped after Overcloud creation)

假设我们有如下网络,应该如何写网络配置文件。

网络类型 Subnet VLAN
PXE/SSH 192.0.2.0/24 access
Internal API 172.16.0.0/24 201
Tenant 172.17.0.0/24 202
Storage 172.18.0.0/24 203
Storage Management 172.19.0.0/24 204
External / Floating IP 192.168.122.0/24 205

编写network-environment.yaml

  1. resource_registry:
  2. # 为每个类型的节点指定网卡配置文件 (这些文件必须存在)
  3. OS::TripleO::BlockStorage::Net::SoftwareConfig:
  4. ../network/config/single-nic-vlans/cinder-storage.yaml
  5. OS::TripleO::Compute::Net::SoftwareConfig:
  6. ../network/config/single-nic-vlans/compute.yaml
  7. OS::TripleO::Controller::Net::SoftwareConfig:
  8. ../network/config/single-nic-vlans/controller.yaml
  9. OS::TripleO::ObjectStorage::Net::SoftwareConfig:
  10. ../network/config/single-nic-vlans/swift-storage.yaml
  11. OS::TripleO::CephStorage::Net::SoftwareConfig:
  12. ../network/config/single-nic-vlans/ceph-storage.yaml
  13. parameter_defaults:
  14. # This section is where deployment-specific configuration is done
  15. # PXE(也叫ControlPlane)网络的掩码
  16. ControlPlaneSubnetCidr: '24'
  17. # PXE网络的网关,使用Management网络时也需要填写。
  18. ControlPlaneDefaultRoute: 10.0.131.1
  19. EC2MetadataIp: 10.0.131.2 # Generally the IP of the Undercloud
  20. # 指定各种网络的子网
  21. InternalApiNetCidr: 10.0.132.0/24
  22. StorageNetCidr: 10.0.133.0/24
  23. StorageMgmtNetCidr: 10.0.134.0/24
  24. TenantNetCidr: 10.0.135.0/24
  25. ExternalNetCidr: 10.0.136.0/24
  26. # 指定各类网络的vlan id
  27. InternalApiNetworkVlanID: 4002
  28. StorageNetworkVlanID: 4003
  29. StorageMgmtNetworkVlanID: 4004
  30. TenantNetworkVlanID: 4005
  31. ExternalNetworkVlanID: 4006
  32. # 指定各类网络的IP地址范围 (IP和Vip)
  33. InternalApiAllocationPools: [{'start': '10.0.132.51', 'end': '10.0.132.80'}]
  34. StorageAllocationPools: [{'start': '10.0.133.51', 'end': '10.0.133.80'}]
  35. StorageMgmtAllocationPools: [{'start': '10.0.134.51', 'end': '10.0.134.80'}]
  36. TenantAllocationPools: [{'start': '10.0.135.51', 'end': '10.0.135.80'}]
  37. # Leave room if the external network is also used for floating IPs
  38. ExternalAllocationPools: [{'start': '10.0.136.51', 'end': '10.0.136.200'}]
  39. # External 网络的网关
  40. ExternalInterfaceDefaultRoute: 10.0.136.1
  41. # Management 网络
  42. ManagementNetCidr: 10.0.130.0/24
  43. ManagementAllocationPools: [{'start': '10.0.130.51', 'end', '10.0.130.80'}]
  44. # Use either this parameter or ControlPlaneDefaultRoute in the NIC templates
  45. ManagementInterfaceDefaultRoute: 10.0.130.1
  46. # Define the DNS servers (maximum 2) for the overcloud nodes
  47. DnsServers: ["119.29.29.29","8.8.4.4"]
  48. # Set to empty string to enable multiple external networks or VLANs
  49. NeutronExternalNetworkBridge: "''"
  50. # The tunnel type for the tenant network (vxlan or gre). Set to '' to disable tunneling.
  51. NeutronTunnelTypes: 'vxlan'
  52. NeutronTenantNetwork: 'vxlan'
  53. # bond 网络类型
  54. BondInterfaceOvsOptions: "bond_mode=active-backup"
  55. # external 网络别名
  56. NeutronBridgeMappings: "datacentre:br-ex"
  57. # external vlan网络范围
  58. NeutronNetworkVLANRanges: "datacentre:4007:4015"

2. 为主机指定IP

在使用isolation network部署overcloud时,所有的isolation netwrok IP 都会从network-environment.yaml定义的pool中获取。在部署生产环境时,一定不想让IP可控:每台节点都随机的从IP pool里随机挑选IP会让排错异常困难。因为你不知道哪个节点用哪个IP。那么 How?

要为主机指定固定IP,需要ips-from-pool-all.yaml

  1. $ cp /usr/share/openstack-tripleo-heat-templates/environments/ips-from-pool-all.yaml ~/templates/

ips-from-pool-all.yaml中指定IP

  1. a

3. 部署代码自定义

3.

Vip registry

  1. resource_registry:
  2. OS::TripleO::Network::Ports::NetVipMap: /usr/share/openstack-tripleo-heat-templates/network/ports/net_vip_map_external.yaml
  3. OS::TripleO::Network::Ports::ExternalVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/noop.yaml
  4. OS::TripleO::Network::Ports::InternalApiVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/noop.yaml
  5. OS::TripleO::Network::Ports::StorageVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/noop.yaml
  6. OS::TripleO::Network::Ports::StorageMgmtVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/noop.yaml
  7. OS::TripleO::Network::Ports::RedisVipPort: /usr/share/openstack-tripleo-heat-templates/network/ports/from_service.yaml

Vip parameter

  1. parameter_defaults:
  2. ...
  3. # Predictable VIPs
  4. ControlPlaneIP: 192.168.0.230
  5. ExternalNetworkVip: 10.1.1.190
  6. InternalApiNetworkVip: 172.16.0.30
  7. StorageNetworkVip: 172.18.0.30
  8. StorageMgmtNetworkVip: 172.19.0.40
  9. ServiceVips:
  10. redis: 172.16.0.31