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

Install Red Hat 3scale and configure tenants with 7 simple commands

September 9, 2019
Henrique Viecili
Related topics:
DevOps
Related products:
Red Hat 3scale API Management

    A couple weeks ago I was faced with the challenge of installing Red Hat 3scale and configuring its tenants using solely the command line — no GUI allowed. This is a rather interesting use case, so I decided to write this article and show how to do it with just seven commands!

    (By the way, I also decided to include Red Hat Single Sign-On (SSO) in the mix because I want my APIs to use OpenID Connect (OIDC) for authentication. But I'll leave those commands to a future article.)

    Requirements

    With the challenge at hand, I knew that if I were to succeed I would have to make good use of the 3scale Master API and some ingenuity. But before jumping into the solution, here are the basic requirements that need to be in place:

    • Access via the oc CLI to an OpenShift cluster with rights to create projects (or have at least two projects created for you, one for the management and one for each tenant).
    • 3scale OpenShift Templates to install 3scale components (amp.yml and apicast.yml).
    • Images and ImageStreams for 3scale.

    Disclaimer: I am using Red Hat OpenShift 3.11 with 3scale v2.5. Newer versions of 3scale (2.6+) on OpenShift 4.x introduce the option of using the 3scale Operator for installation, which is quite different from what is described here.

    Commands

    So, here we go. Let's install 3scale and the tenant!

    Note: In the next sections, whenever you see ${A_PLACEHOLDER_NAME}, it means something that needs to be replaced by a value, either self-explanatory or defined in a previous step.

    Command #0: Ensure you've got the basics

    # the templates
    git clone https://github.com/3scale/3scale-amp-openshift-templates
    # the access with CLI
    oc login ${YOUR_OCP_MASTER_CONSOLE_URL}
    # the projects created
    oc new-project 3scale-management-project
    oc new-project 3scale-tenant-project

    Command #1: Install 3scale (management)

    The command below is a minimal command to install 3scale. Many other configuration parameters are available, and I highly recommend reading the installation guide. For the purposes of this use case, it is sufficient.

    The MASTER_NAME (=3scale-master) parameter is used as a prefix to create the URL of the 3scale Master API. In this case, the final URL should look like 3scale-master.apps.ocp.example.com

    oc new-app --file amp.yml \
      -p WILDCARD_DOMAIN=apps.ocp.example.com \
      -p MASTER_NAME=3scale-master \
      -n 3scale-management-project

    IMPORTANT: The output of the command above will contain some generated tokens and secrets; take note of them. The remaining commands will use the MASTER_ACCESS_TOKEN but you may need the other values in the future.

    Once the installation triggered by the previous command completes, you can start creating the tenant with the next commands.

    Command #2: Create the tenant via the Master API

    The parameters below will use the variable TENANT_NAME to represent the name of the tenant and other parameters will be derived from it. You should replace/define it with the name you want for the tenant, for example, devblog.

    curl -X POST \
      https://3scale-master.apps.ocp.example.com/master/api/providers.xml \
      -d "access_token=${MASTER_ACCESS_TOKEN}" \
      -d "org_name=${TENANT_NAME}-tenant" \
      -d "username=${TENANT_NAME}-tenant-admin" \
      --data-urlencode "email=${TENANT_NAME}@example.com" \
      -d "password=${A_PASSWORD}"

    The Master API should return a successful response containing the XML representation of the new tenant configuration. Look for the following data within the payload:

    • TENANT_ACCESS_TOKEN from the value of the element /signup/access_token/value
    • TENANT_ACCOUNT_ID from the value of the element /signup/account/id
    • TENANT_USER_ID from the value of the element /signup/users/user[0]/id

    Command #3: Activate the tenant

    By default, new tenants are not created active. Run the command below to activate it.

    curl -X PUT \
      "https://3scale-master.apps.ocp.example.com/admin/api/accounts/${TENANT_ACCOUNT_ID}/users/${TENANT_USER_ID}/activate.xml" \
      -d "access_token=${MASTER_ACCESS_TOKEN}"

    Command #4: Create the tenant's Admin Portal route

    This command creates the route to configure the gateway (apicast) so it can communicate to its API Manager.

    oc create route edge ${TENANT_NAME}-admin \
      --service=system-provider \
      --hostname=${TENANT_NAME}-tenant-admin.apps.ocp.example.com \
      --insecure-policy=Allow \
      -n 3scale-management-project

    You can access the tenant's Admin Portal through this new URL with the credentials (username/password) provided in Command #2.

    Command #5: Create the secret with the AMP management URL

    oc secret new-basicauth apicast-configuration-url-secret \
      --password=https://${TENANT_ACCESS_TOKEN}@${TENANT_NAME}-tenant-admin.apps.ocp.example.com \
      -n 3scale-tenant-project

    Command #6: Install the tenant's API gateway (apicast)

    The command below installs only the apicast gateway pods. As this tenant won't handle production workloads, it uses the minimal configuration parameters recommended for non-production deployments.

    oc new-app -f apicast.yml \
      -p CONFIGURATION_LOADER=lazy \
      -p DEPLOYMENT_ENVIRONMENT=staging \
      -p CONFIGURATION_CACHE=0 \
      -n 3scale-tenant-project

    Command #7: Expose your tenant's API gateway

    Now you just need to create the route (URL) to expose your apicast service (the gateway) to its clients.

    oc create route edge \
      --service=apicast \
      --hostname=${TENANT_NAME}-tenant.apps.ocp.example.com \
      --insecure-policy=Allow \
      -n 3scale-tenant-project

    The APIs you create for this tenant will be exposed through this new URL.

    To create more tenants, just repeat commands #2 to #7.

    Conclusion

    As we move toward automating all the things, it is important to challenge ourselves not to use GUIs and instead do things the harder but more repeatable way. Getting the set of commands is just the first step for automation. Next, we can compile them in the form of a script, or even better, an Ansible playbook. The automation that such capability provides means not only that new tenants can be easily created, but also that the whole environment can be rebuilt from code.

    Although these commands show a simple configuration of 3scale, the gist was extracted from a real-life consulting engagement when each tenant represents one of the multiple environments of a software delivery lifecycle — like development, testing, integration, pre-production, and production. Ultimately, this is part of a bigger picture where our customers need to have the full API lifecycle as code so it can be automated.

    Last updated: September 6, 2019

    Recent Posts

    • Testing infrastructure red teaming with abliterated models

    • Build an enterprise RAG system with OGX

    • Solutions for SELinux MCS challenges with GitLab runners

    • MCP servers vs. skills: Choosing the right context for your AI

    • How to route external and local LLMs with Models-as-a-Service

    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.