You can configure LBaaS using the command line interface on the node running OpenStack Neutron.

Prerequisites

  • Create a public subnet and router on your network. For an NSX-V deployment, the router type must be exclusive.

    Note:

    You can create the load balancer on a tenant subnet, but you must assign it a floating IP address.

  • Configure at least one client and at least two server instances.

  • If you want to use TLS, verify that the server certificate and private key have been imported into the trust store for secrets on the NSX Manager.

Procedure

  1. Log in to the node running OpenStack Neutron and switch to the root user.
    sudo su -
  2. Create a load balancer.
    neutron lbaas-loadbalancer-create --name lb-name lb-subnet-id

    Only members of the specified subnet can be added to the LBaaS pool.

  3. Create a listener for the new load balancer.
    neutron lbaas-listener-create --loadbalancer lb-name --protocol {HTTP | TCP | TERMINATED_HTTPS} --protocol-port port-num --name listener-name [--default-tls-container=nsxt-cert-uuid]

    If you want to use TLS, set the protocol to TERMINATED_HTTPS and provide the ID of the NSX-T server certificate.

  4. Create an LBaaS pool.
    neutron lbaas-pool-create --lb-algorithm lb-method --listener listener-name --protocol {TCP | HTTP} --name pool-name

    The --lb-algorithm parameter accepts the following values.

    Argument

    Description

    LEAST_CONNECTIONS

    New client requests are sent to the server with the fewest connections.

    ROUND_ROBIN

    Each server is used in turn according to the weight assigned to it.

    SOURCE_IP

    All connections that originate from the same source IP address are handled by the same member of the pool.

  5. Add at least two server instances to the LBaaS pool that you created.
    neutron lbaas-member-create --subnet lb-subnet-id --address server1-ip --protocol-port 80 pool-name
    neutron lbaas-member-create --subnet lb-subnet-id --address server2-ip --protocol-port 80 pool-name
  6. Set up the health monitor.
    neutron lbaas-healthmonitor-create --delay delay-seconds --type {HTTP | TCP | PING} --max-retries number --timeout timeout-seconds --pool pool-name

    Parameter

    Description

    --delay

    Time in seconds between sending probes to members.

    --type

    One of the predefined health monitor types. Specify HTTP, TCP, or PING.

    --max-retries

    Number of connection failures allowed before changing the member status to INACTIVE.

    --timeout

    Time in seconds that a monitor will wait for a connection to be established before it times out.

    The timeout value must be less than the delay value.

    --pool

    New LBaaS pool.

  7. If you created the load balancer on a tenant subnet, associate a floating IP address with the load balancer.
  8. (Optional) Send test requests to validate your LBaaS configuration.
    1. Log in to the OpenStack Management Server.
    2. Create a test index.html file.
    3. In the same directory, start a web server.
      sudo python -m SimpleHTTPServer 80
    4. Log in to the client instance.
    5. Run the wget command and view whether your requests are being correctly load-balanced across the servers in the pool.
      • For load balancing without TLS, run the following command:

        wget -O - http://mgmt-server-ip
      • For load balancing with TLS, run the following command:

        wget -O - https://mgmt-server-ip