Creating custom load balancer flavors

Load balancer flavors are predefined sets of provider configuration options. They are defined per provider driver and expose the unique capabilities of each provider.

By default, there are two load balancer flavors:

  • ACTIVE_STANDBY is used to build highly available load balancers with two instances
  • SINGLE is used to build load balancers with single instances

If needed, administrators can add more flavors and set them as default for Kubernetes clusters. Additionally, self-service users can specify the external load balancer flavor for their Kubernetes applications (refer to "Creating external load balancers in Kubernetes" in the Self-Service Guide).

Prerequisites

To create a load balancer flavor

  1. List the load balancer provider capabilities and choose those that will be configured in the flavor. As we use the amphora provider, run:

    # openstack --insecure loadbalancer provider capability list amphora
    +-------------------+-----------------------+---------------------------------------------------+
    |type               | name                  | description                                       |
    +-------------------+-----------------------+---------------------------------------------------+
    | flavor            | loadbalancer_topology | The load balancer topology. One of:               |
    |                   |                       | SINGLE - One amphora per load balancer.           |
    |                   |                       | ACTIVE_STANDBY - Two amphora per load balancer.   |
    | flavor            | compute_flavor        | The compute driver flavor ID.                     |
    | availability_zone | compute_zone          | The compute availability zone.                    |
    | availability_zone | management_network    | The management network ID for the amphora.        |
    | availability_zone | valid_vip_networks    | List of network IDs that are allowed for VIP use. |
    |                   |                       | This overrides/replaces the list of allowed       |
    |                   |                       | networks configured in `octavia.conf`.            |
    +-------------------+-----------------------+---------------------------------------------------+
  2. List the current compute flavors to learn their IDs:

    # openstack --insecure flavor list
    +-----+--------+-------+------+-----------+-------+-----------+
    | ID  | Name   |   RAM | Disk | Ephemeral | VCPUs | Is Public |
    +-----+--------+-------+------+-----------+-------+-----------+
    | 100 | tiny   |   512 |    0 |         0 |     1 | True      |
    | 101 | small  |  2048 |    0 |         0 |     1 | True      |
    | 102 | medium |  4096 |    0 |         0 |     2 | True      |
    | 103 | large  |  8192 |    0 |         0 |     4 | True      |
    | 104 | xlarge | 16384 |    0 |         0 |     8 | True      |
    +-----+--------+-------+------+-----------+-------+-----------+
    
  3. Create a flavor profile that is responsible for the load balancer topology and associated with a compute flavor. Load balancers use the same compute flavor as virtual machines. For example, to create a flavor profile that will build highly available load balancers with the small flavor, run:

    # openstack --insecure loadbalancer flavorprofile create --name amphora-ha-small --provider amphora  \
    --flavor-data '{"loadbalancer_topology": "ACTIVE_STANDBY", "compute_flavor": "101"}'
    +---------------+-----------------------------------------------------------------------+
    | Field         | Value                                                                 |
    +---------------+-----------------------------------------------------------------------+
    | id            | a1c7d342-df30-490d-b3ec-29d36ff1b0ba                                  |
    | name          | amphora-ha-small                                                      |
    | provider_name | amphora                                                               |
    | flavor_data   | {"loadbalancer_topology": "ACTIVE_STANDBY"}, "compute_flavor": "101"} |
    +---------------+-----------------------------------------------------------------------+
    

    The created flavor profile will appear in the flavor profile list:

    # openstack --insecure loadbalancer flavorprofile list
    +--------------------------------------+--------------------+---------------+
    | id                                   | name               | provider_name |
    +--------------------------------------+--------------------+---------------+
    | a1c7d342-df30-490d-b3ec-29d36ff1b0ba | amphora-ha-small   | amphora       |
    | c8fccae7-25da-4493-985e-c5dc8def85ba | amphora-single     | amphora       |
    | d20a9a33-60f9-40c4-85ff-8434bb393ef7 | amphora-act-stndby | amphora       |
    +--------------------------------------+--------------------+---------------+
    
  4. Create a load balancer flavor using the new flavor profile. For example:

    # openstack --insecure loadbalancer flavor create --name HA-SMALL --enable --flavorprofile amphora-ha-small
    +-------------------+--------------------------------------+
    | Field             | Value                                |
    +-------------------+--------------------------------------+
    | id                | b8b84c9e-7a15-4693-8a06-20ddb1faa75e |
    | name              | HA-SMALL                             |
    | flavor_profile_id | a1c7d342-df30-490d-b3ec-29d36ff1b0ba |
    | enabled           | True                                 |
    | description       |                                      |
    +-------------------+--------------------------------------+
    

The new load balancer flavor will appear in the openstack loadbalancer flavor list output:

# openstack --insecure loadbalancer flavor list
+--------------------------------------+----------------+--------------------------------------+---------+
| id                                   | name           | flavor_profile_id                    | enabled |
+--------------------------------------+----------------+--------------------------------------+---------+
| aab01389-4496-4641-b84a-815f6eedfe37 | ACTIVE_STANDBY | d20a9a33-60f9-40c4-85ff-8434bb393ef7 | True    |
| b8b84c9e-7a15-4693-8a06-20ddb1faa75e | HA-SMALL       | 3dd5a148-b8c5-4105-9489-4d8d1b0c5fc0 | True    |
| d42cae3e-ff87-4155-b6a2-17bfa38111a1 | SINGLE         | c8fccae7-25da-4493-985e-c5dc8def85ba | True    |
+--------------------------------------+----------------+--------------------------------------+---------+

Now, you can use the new flavor for creating load balancers through OpenStack command-line interface or via the Kuberenetes deployment file. For more details, refer to the official OpenStack documentation.