Create HTTP Load Balancer

Now that we’ve defined our Origin Pools for the SPA and API service, we need to attach the pools to an HTTP Load Balancer. The HTTP Load Balancer will direct traffic to our pools based on URI through the concept of “Routes”.


Exercise 1: HTTP Load Balancer Basic Configuration

  1. Start in F5 Distributed Cloud Console and switch to the Load Balancers context.

    load_balancers_context

  2. Ensure you have selected your assigned namespace

  3. Navigate the menu to go to “Manage”->”HTTP Load Balancers” and click on “Add HTTP Load Balancers”.

    http_lb_menu http_lb_add

  4. Enter the following variables:

    Variable

    Value

    Name

    brews-lb

    Domains

    [unique name]-brews.[supplied domain name for your tenant]

    Select type of Load Balancer

    HTTP

    Automatically Manage DNS Records

    Yes/Check

    lb-basic

    Note

    If your tenant does not use a delegated domain you can disable the option to automatically manage DNS records. You can supply an arbitrary domain (example.com) and later you can use the following command to verify.

    $ curl --resolve [unique-name]-brews.example.com:80:[IP address of ves.io name created by LB] http://[unique-name]-brews.example.com
    

Exercise 2: Configure Default Origin Server

We’ll next configure the “Default Origin Servers”. These are the Origin Servers that will be used for requests without a more specific route. For the DemoBrews application, we want to send traffic not related to the API service (or images) to the SPA service.

  1. Click on the Configure link under the Default Origin Servers section.

  2. Click the Add Item button.

  3. The “Select Origin Pool Method” will be set to “Origin Pool”. Under the “Origin Pool” dropdown menu select the “brews-spa-pool” you created earlier.

    lb-default-origin

  4. Click the Apply button to exit the “Origin Pools” dialogue.


Exercise 3: Configure Routes

Now we’re ready to configure URL-based pool selection for the API service and static images. We will need 2 separate routes to send traffic to the API service – “/api/” and “/images/”.

  1. In the Routes Configuration section toggle the Show Advanced Fields button. Click the Configure link.

    lb-route-advanced

  2. Click the Add item button

  3. Enter the following variables:

    Variable

    Value

    Select Type of Route

    Simple Route

    HTTP Method

    ANY

    Path Match

    Prefix

    Prefix

    /api/

  4. Under the Origin Pools section Click the Configure link.

    lb-route1

  5. Click the Add item button.

  6. Under the Origin Pool section select the dropdown and choose the “brews-api-pool” you created earlier.

    lb-op-api

  7. Click the Apply button to exit the “Origin Pool” dialogue and return to the “Routes” dialogue.

  8. Click Add item to add a second route. Create a route for “ANY” HTTP Methods with a prefix of “/images/” that points to the “brews-api-pool” you created earlier.

    lb-route2

    Note

    You should now have 2 routes created in the “Routes” dialogue.

    Warning

    Don’t forget for the second route, to configure an Origin Pool

  9. Click Apply to exit the “Routes” dialogue.

  10. Notice that in the “VIP Creation” section Advertise On Internet has been selected by default.

    lb-vip

  11. Click “Save and Exit to create the HTTP Load Balancer.

Once the HTTP Load Balancer has been deployed, you should now be able to go to the DNS name that you entered previously in a web browser. The FQDN we used in our example is http://labuser-brews.f5-consult.f5pslab.com. Your FQDN should follow the format of [unique name]-brews.[supplied domain name for your tenant].

The demo app should look like the screen shot below:

demo_app


Packet flow

Below is the packet flow for the architecture you just deployed in F5 Distributed Cloud.

flow_state1




../../_images/stop.png

You have reached the end of this lab. For instructor-led courses, do not continue until instructed to do so.