Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

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

    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

    • Preventing GPU waste: A guide to JIT checkpointing with Kubeflow Trainer on OpenShift AI

    • How to manage TLS certificates used by OpenShift GitOps operator

    • Configure a split disk on OpenShift Container Platform

    • Red Hat Enterprise Linux 10.2 and 9.8: Top features for developers

    • What GPU kernels mean for your distributed inference

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    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
    © 2026 Red Hat

    Red Hat legal and privacy links

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

    Chat Support

    Please log in with your Red Hat account to access chat support.