Internal HTTP Load Balancer

Previously we deployed a public HTTP Load Balancer to direct traffic to the single-page application. Next we will deploy an internal/private HTTP Load Balancer that will be used to serve the inventory application.


Inventory Application

Now you are ready to set up an HTTP Load Balancer to serve the inventory application.


Exercise 1: Create an HTTP Load Balancer

  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. Configure HTTP Load Balancer

    Now you will create an HTTP load balancer configuration. Enter the following variables:

    Variable

    Value

    Name

    inventory-lb

    Domains

    your_namespace-inventory.brews.local

    Select type of Load Balancer

    HTTP

    Automatically Manage DNS Records

    No/Un Checked

    http_lb


Exercise 2: Configure Origin Server (for UDF)

Now you will configure the Default Origin Server used by the load balancer.

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

  2. Click the Add Item button.

  3. In the Origin Pool drop down, click Create new pool.

  4. Enter the following variables:

    Variable

    Value

    Name

    brews-inventory

    Select Type of Origin Server

    IP address of Origin Server on given Sites

    IP

    10.1.1.4

    Site

    your_namespace-udf

    Select Network on the site

    Outside Network

    Port

    8002

    http_lb_origin_pool_config

  5. Configure Origin Pool Health monitor
    • In the List of Health Check(s) section click the Add item button.

    • Click the Health Check object dropdown list.

    • Click the Create new healthcheck button.

    • Enter the following variables:

      Variable

      Value

      name

      brews-inventory

    • Click the configure button under HTTP Health Check and enter the following variables:

      Variable

      Value

      path

      /api/stats

    • Click the Apply button to close the “HTTP Health Check” dialogue.

  6. Click the Continue button to close the “Health Check” dialogue.


Exercise 3: Configure Second Origin Pool (for AWS)

  1. Under “Origin Servers” click on Add item

  2. Enter the following variables:

    Variable

    Value

    Select Type of Origin Server

    K8s Service Name of Origin Server on given Sites

    Service Name

    brews-inv.[your namespace]

    Virtual Site

    your_namespace-vsite

    Select Network on the site

    vK8s Network on Site

    Note

    Be sure to use the value of “[your namespace]” this is how F5 Distributed Cloud identifies the resource

  3. Click Continue.

  4. Click Apply to return to the HTTP Load Balancer dialogue. Stop here.


Exercise 4: Configure Custom VIP Configuration

Unlike when you created a public HTTP LB this needs to be configured to only listen on the internal network of the UDF and AWS sites.

  1. Under VIP Configuration click on Show Advanced Fields.

  2. From the “Select” menu change the value to “Advertise Custom” http_lb_custom_vip

  3. Click on Configure under “Advertise Custom”.

  4. Enter the following variables:

    Variable

    Value

    Select Where to Advertise

    Site (default value)

    Site Network

    Outside Network

    Site

    [unique name]-udf

    IP address

    [leave blank, default value]

    TCP Listen Port Choice

    Use Default TCP Listen Port (default value)

  5. Click on Add Item.

  6. Enter the following variables:

    Variable

    Value

    Select Where to Advertise

    Site (default value)

    Site Network

    Outside Network

    Site

    [unique name]-aws

    IP address

    [leave blank, default value]

    TCP Listen Port Choice

    Use Default TCP Listen Port (default value)

  7. Click on Apply to close the “Advertise Custom” dialogue.

  8. Click on Save and Exit to create the HTTP Load Balancer.


Exercise 5: Verify Internal LB is working

You will need to now reconfigure the “brews” app to use the inventory application.

  1. Navigate to the “stats” page of the brews app. Click on the gear icon next to “inventory”.

    brews-app-inventory-settings

  2. Enter the value for the internal URL “http://your_namespace-inventory.brews.local”. Click on the checkmark icon.

    brews-app-inventory-config

  3. The “API” application will now use the internal LB to communicate with the inventory service. When you view a product page you should now see an option for In Store or Delivery:

    demo_app_inventory

  4. The configuration of the inventory LB is set to prefer the origin of the site. This should result in the following pattern of traffic.

  • AWS API Service -> AWS Inventory Service

  • UDF API Service -> UDF Inventory Service

If you disable the Inventory Service in AWS, all traffic will go to the remaining UDF site.


Packet flow

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

flow_state4




../../_images/stop.png

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