Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Simplify load balancing for API gateways using Red Hat 3scale API Management

August 11, 2021
Srikanth Valluru
Related topics:
APIs
Related products:
Red Hat 3scale API ManagementRed Hat OpenShift

Share:

    One of the conveniences offered by Red Hat 3scale API Management is simplified load balancing on API gateways. This article shows how to use a route on Red Hat OpenShift and 3scale API Management to load balance two API gateways installed on an OpenShift instance.

    Figure 1 shows the architecture used in this article. This setup is only one of several ways to deploy API gateways. Examples of setups that are not discussed in this article include the following:

    • Deploy API gateways inside your corporate network closer to your API, and place a load balancer (registered with 3scale API Management) in your demilitarized zone (DMZ) to handle load balancing, allowing high performance and avoiding a single point of failure. This architecture hides your API gateway from the outside world.
    • Install the API gateways via Docker containers along with a load balancer that forwards requests to the Docker containers.
    • Use Kubernetes scaling in OpenShift to run the desired number of API gateway pods and have OpenShift’s route feature take care of load balancing.
    In the architecture used for this article, OpenShift contains a load balancer that splits requests between two services provided by two API gateways.
    Figure 1: Load balancer between the 3scale API Management and the API gateways.

    Prerequisites

    Before starting the procedure in this article, you need to:

    1. Set up 3scale API Management on either SaaS or Red Hat OpenShift.
    2. Create a back-end product for the default staging and production API gateways.
    3. Set up a project (namespace) on OpenShift where you'll install the 3scale API gateway operator.

    In my configuration, I used the SaaS version for 3scale API Management with an Echo API.

    Set up the load balancer

    The rest of this article sets up load balancing by taking you through the following steps:

    1. Install the 3scale APIcast gateway operator.
    2. Deploy one instance of a self-managed API gateway.
    3. Deploy a second instance of a self-managed API gateway.
    4. Configure an OpenShift route for the load balancer.
    5. Configure a 3scale API Management product using the load balancer route's URL.
    6. Promote your product API to use the load balancer route's URL in the staging API gateway.
    7. Test the API.

    The following video also walks through the steps. As it shows, the whole process can take less than ten minutes.

    Step 1: Install the 3scale APIcast gateway operator

    From the OpenShift Operator console, install the Red Hat Integration - 3scale APIcast gateway operator (Figure 2).

    The 3scale APIcast gateway Operator is available in the OpenShift console.
    Figure 2: 3scale APIcast gateway operator in the OpenShift console.

    Step 2: Deploy one instance of a self-managed API gateway

    The "Deploying an APIcast gateway self-managed solution using the operator" section of the 3scale API Management documentation describes this step in detail.

    Step 3: Deploy a second instance of a self-managed API gateway

    The procedure is just like installing the first instance, except that you should use a different secret. In other words, the secret shown in the following configuration parameter must be different in the two instances:

    spec:
      adminPortalCredentialsRef:
        name: SOME_SECRET_NAME

    The second instance of a self-managed API gateway in the same project (namespace) involves a slight change in how the secret is created.

    At this point, you should see the two API gateways in the console (Figure 3).

    Two instances are shown under 3scale APIcast gateway in the console.
    Figure 3: 3scale APIcast gateways in the console.

    There are also two pods running, one for each API gateway (Figure 4).

    Two pods are running 3scale APIcast gateways.
    Figure 4: 3scale APIcast pods in the console.

    Step 4: Configure an OpenShift route for the load balancer

    There are many ways to configure a load balancer. This section uses the OpenShift route to split traffic between services.

    Figure 5 shows the services for the API gateways you created previously.

    Screenshot showing two services listed in the 3scalegateway project: apicast-example2-apicast and apicast-example-apicast.
    Figure 5: The services listed in the 3scalegateway project.

    While creating the route, configure the two services with equal service weight (Figure 6).

    The load balancer route has its own configuration.
    Figure 6: Configuration for the load balancer route.

    Step 5: Configure a 3scale API Management product using the load balancer route's URL

    Go to 3scale API Management → Products → <Product Name> → Integration → Settings. Copy the route URL from Step 4 and set the Staging Public Base URL and Production Public Base URL in 3scale API Management (Figure 7).

    The product has its own configuration.
    Figure 7: 3scale API Management configuration.

    Step 6: Promote your product API to use the load balancer route's URL in the staging API gateway

    Go to 3scale API Management → Products → <Product Name> → Integration → Configuration and promote the Staging APIcast configuration (Figure 8).

    The APIcast has its own configuration.
    Figure 8: Configuration for the APIcast.

    Step 7: Test the API

    The APIcast Configuration page shown in Figure 8 contains a cURL command that you can use to test the service. Repeat it to fire up a few requests. You should then see requests sent to both API gateways in a round-robin fashion. Figure 9 highlights the parts of the output that show how both API gateways are responding.

    Information retrieved by cURL commands to the service show that two different hosts are responding.
    Figure 9: Information retrieved by cURL commands to the service.

    Conclusion

    3scale API Management supports multiple deployment strategies with API gateways. For more information, see the following links:

    • Installing APIcast
    • Deploying APIcast on the Docker containerized environment
    Last updated: September 19, 2023

    Related Posts

    • Custom policies in Red Hat 3scale API Management, Part 1: Overview

    • Packaging APIs for consumers with Red Hat 3scale API Management

    • Adding API Gateway Policies Now Easier With Red Hat 3scale API Management

    Recent Posts

    • How to deploy EVPN in OpenStack Services on OpenShift

    • Ollama or vLLM? How to choose the right LLM serving tool for your use case

    • How to build a Model-as-a-Service platform

    • How Quarkus works with OpenTelemetry on OpenShift

    • Our top 10 articles of 2025 (so far)

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue