Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Install python pip
- sudo apt install python-pip
- # Eventually create a virtualenv
- sudo apt install python3-virtualenv
- virtualenv octavia_disk_image_create
- source octavia_disk_image_create/bin/activate
- # Install octavia requirements
- git clone https://opendev.org/openstack/octavia.git
- cd octavia/diskimage-create/
- pip install -r requirements.txt
- sudo apt install qemu-utils git kpartx debootstrap
- sudo chmod 0644 /boot/vmlinuz*
- bash diskimage-create.sh -g stable/train
- Successfully built the amphora using the stable/train amphora-agent.
- Amphora image size: /home/sytel/octavia/diskimage-create/amphora-x64-haproxy.qcow2 395847168
- openstack image create --disk-format qcow2 \
- --container-format bare --tag octavia-amphora-image --file /home/sytel/octavia/diskimage-create/amphora-x64-haproxy.qcow2 \
- --public --project admin amphora-x64-haproxy
- # create db
- mysql -u root -p
- CREATE DATABASE octavia;
- CREATE USER 'octavia'@'localhost' IDENTIFIED BY 'octavia';
- GRANT ALL PRIVILEGES ON *.* TO 'octavia'@'localhost' with grant option;
- CREATE USER 'octavia'@'%' IDENTIFIED BY 'octavia';
- GRANT ALL PRIVILEGES ON *.* TO 'octavia'@'%' with grant option;
- \q
- openstack user create --domain default --password-prompt octavia
- > octavia
- > octavia
- openstack role add --user octavia --project admin admin
- openstack role add --project service --user octavia admin
- openstack service create --name octavia --description "OpenStack Octavia" load-balancer
- openstack endpoint create --region RegionOne \
- load-balancer public http://192.168.122.124:9876
- openstack endpoint create --region RegionOne \
- load-balancer internal http://192.168.122.124:9876
- openstack endpoint create --region RegionOne \
- load-balancer admin http://192.168.122.124:9876
- cat << EOF >> $HOME/octavia-openrc
- export OS_PROJECT_DOMAIN_NAME=Default
- export OS_USER_DOMAIN_NAME=Default
- export OS_PROJECT_NAME=service
- export OS_USERNAME=octavia
- export OS_PASSWORD=octavia
- export OS_AUTH_URL=http://192.168.122.124:5000
- export OS_IDENTITY_API_VERSION=3
- export OS_IMAGE_API_VERSION=2
- export OS_VOLUME_API_VERSION=3
- EOF
- . $HOME/octavia-openrc
- ## build image now
- openstack flavor create --id 200 --vcpus 1 --ram 1024 \
- --disk 2 "amphora" --private
- sudo apt install octavia-api octavia-health-manager octavia-housekeeping \
- octavia-worker python3-octavia python3-octaviaclient
- # If octavia-common and octavia-api packages ask you to configure, choose No.
- git clone https://opendev.org/openstack/octavia.git
- cd octavia/bin/
- source create_dual_intermediate_CA.sh
- sudo mkdir -p /etc/octavia/certs/private
- sudo chmod 755 /etc/octavia -R
- sudo cp -p etc/octavia/certs/server_ca.cert.pem /etc/octavia/certs
- sudo cp -p etc/octavia/certs/server_ca-chain.cert.pem /etc/octavia/certs
- sudo cp -p etc/octavia/certs/server_ca.key.pem /etc/octavia/certs/private
- sudo cp -p etc/octavia/certs/client_ca.cert.pem /etc/octavia/certs
- sudo cp -p etc/octavia/certs/client.cert-and-key.pem /etc/octavia/certs/private
- cd
- . octavia-openrc
- openstack security group create lb-mgmt-sec-grp
- openstack security group rule create --protocol icmp lb-mgmt-sec-grp
- openstack security group rule create --protocol tcp --dst-port 22 lb-mgmt-sec-grp
- openstack security group rule create --protocol tcp --dst-port 9443 lb-mgmt-sec-grp
- openstack security group create lb-health-mgr-sec-grp
- openstack security group rule create --protocol udp --dst-port 5555 lb-health-mgr-sec-grp
- cd $HOME
- sudo mkdir -m755 -p /etc/dhcp/octavia
- sudo cp octavia/etc/dhcp/dhclient.conf /etc/dhcp/octavia
- # network setup
- OCTAVIA_MGMT_SUBNET=172.16.0.0/12
- OCTAVIA_MGMT_SUBNET_START=172.16.0.100
- OCTAVIA_MGMT_SUBNET_END=172.16.31.254
- OCTAVIA_MGMT_PORT_IP=172.16.0.2
- openstack network create lb-mgmt-net
- openstack subnet create --subnet-range $OCTAVIA_MGMT_SUBNET --allocation-pool \
- start=$OCTAVIA_MGMT_SUBNET_START,end=$OCTAVIA_MGMT_SUBNET_END \
- --network lb-mgmt-net lb-mgmt-subnet
- SUBNET_ID=$(openstack subnet show lb-mgmt-subnet -f value -c id)
- PORT_FIXED_IP="--fixed-ip subnet=$SUBNET_ID,ip-address=$OCTAVIA_MGMT_PORT_IP"
- MGMT_PORT_ID=$(openstack port create --security-group \
- lb-health-mgr-sec-grp --device-owner Octavia:health-mgr \
- --host=$(hostname) -c id -f value --network lb-mgmt-net \
- $PORT_FIXED_IP octavia-health-manager-listen-port)
- MGMT_PORT_MAC=$(openstack port show -c mac_address -f value \
- $MGMT_PORT_ID)
- sudo ip link add o-hm0 type veth peer name o-bhm0
- NETID=$(openstack network show lb-mgmt-net -c id -f value)
- BRNAME=brq$(echo $NETID|cut -c 1-11)
- sudo brctl addif $BRNAME o-bhm0
- sudo ip link set o-bhm0 up
- sudo ip link set dev o-hm0 address $MGMT_PORT_MAC
- sudo iptables -I INPUT -i o-hm0 -p udp --dport 5555 -j ACCEPT
- sudo dhclient -v o-hm0 -cf /etc/dhcp/octavia
- sudo vi /etc/systemd/network/o-hm0.network
- [Match]
- Name=o-hm0
- [Network]
- DHCP=yes
- sudo vi /etc/systemd/system/octavia-interface.service
- [Unit]
- Description=Octavia Interface Creator
- Requires=neutron-linuxbridge-agent.service
- After=neutron-linuxbridge-agent.service
- [Service]
- Type=oneshot
- RemainAfterExit=true
- ExecStart=/opt/octavia-interface.sh start
- ExecStop=/opt/octavia-interface.sh stop
- [Install]
- WantedBy=multi-user.target
- # You need to substitute $MGMT_PORT_MAC and $BRNAME for the values in your environment.
- sudo vi /opt/octavia-interface.sh
- #!/bin/bash
- set -ex
- MAC=fa:16:3e:ef:cc:32
- BRNAME=brqa90c6329-88
- if [ "$1" == "start" ]; then
- ip link add o-hm0 type veth peer name o-bhm0
- brctl addif $BRNAME o-bhm0
- ip link set o-bhm0 up
- ip link set dev o-hm0 address $MAC
- ip link set o-hm0 up
- iptables -I INPUT -i o-hm0 -p udp --dport 5555 -j ACCEPT
- elif [ "$1" == "stop" ]; then
- ip link del o-hm0
- else
- brctl show $BRNAME
- ip a s dev o-hm0
- fi
Advertisement
Add Comment
Please, Sign In to add comment