User Tools

Site Tools


recipe:lb

Creating a load balancer

openstack loadbalancer create --vip-network-id VLAN164 --name my-lb
openstack loadbalancer listener create --name listen-http --protocol HTTP --protocol-port 80 my-lb
openstack loadbalancer listener create --name listen-https --protocol HTTPS --protocol-port 443 my-lb
openstack loadbalancer pool create --name pool-http --lb-algorithm ROUND_ROBIN --listener pool-http --protocol HTTP
openstack loadbalancer pool create --name pool-https --lb-algorithm ROUND_ROBIN --listener pool-https --protocol HTTPS

cat virtual_hosts.txt | while read host;
do 
  openstack loadbalancer member create --subnet-id 9f9a73fd-2a98-4cfb-ac43-645b119e0135 --address $host --protocol-port 80 pool-http
  openstack loadbalancer member create --subnet-id 9f9a73fd-2a98-4cfb-ac43-645b119e0135 --address $host --protocol-port 443 pool-https
done

The Result

A free IP on VLAN164 will immediately start listening on port 80 or 443 for HTTP, HTTPS. Any traffic to those ports will be replayed back to a healthly (responding) virtual instance on the subnet id 9f9a73fd-2a98-4cfb-ac43-645b119e0135.

Destroying Load Balancer

BUGS!

(beware: many/most of the comments on that bug are incorrect, including workarounds)

Otherwise, if the load balancer is online:

openstack loadbalancer delete my-lb --cascade
/var/lib/dokuwiki/data/pages/recipe/lb.txt · Last modified: 2018/12/07 12:36 by chudler