Red Hat 3scale API Management 2.8
Red Hat 3scale API Management 2.8
Installing 3scale
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons
Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is
available at
http://creativecommons.org/licenses/by-sa/3.0/
. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must
provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert,
Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift,
Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States
and other countries.
Linux ® is the registered trademark of Linus Torvalds in the United States and other countries.
XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States
and/or other countries.
MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and
other countries.
Node.js ® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the
official Joyent Node.js open source or commercial project.
The OpenStack ® Word Mark and OpenStack logo are either registered trademarks/service marks
or trademarks/service marks of the OpenStack Foundation, in the United States and other
countries and are used with the OpenStack Foundation's permission. We are not affiliated with,
endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
Abstract
This guide provides the information to install and configure 3scale API Management.
Table of Contents
Table of Contents
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5. . . . . . . . . . . . .
PREFACE
.CHAPTER
. . . . . . . . . . 1.. .INSTALLING
. . . . . . . . . . . . . 3SCALE
. . . . . . . . . ON
. . . . OPENSHIFT
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6. . . . . . . . . . . . .
1.1. SYSTEM REQUIREMENTS FOR INSTALLING 3SCALE ON OPENSHIFT 6
1.2. CONFIGURING NODES AND ENTITLEMENTS 7
1.3. DEPLOYING 3SCALE ON OPENSHIFT USING A TEMPLATE 8
1.3.1. Configuring registry authentication in OpenShift 8
1.3.2. Creating registry service accounts 9
1.3.3. Modifying registry service accounts 10
1.3.4. Importing the 3scale template 10
1.3.5. Getting the Admin Portal URL 12
1.3.6. Configuring SMTP Variables (Optional) 12
1.4. PARAMETERS OF THE 3SCALE TEMPLATE 13
1.5. USING APICAST WITH 3SCALE ON OPENSHIFT 17
1.5.1. Deploying APIcast templates on an existing OpenShift cluster containing 3scale 17
1.5.2. Connecting APIcast from a different OpenShift cluster 18
1.5.3. Changing the default behavior for embedded APIcast 19
1.5.4. Connecting multiple APIcast deployments on a single OpenShift cluster over internal service routes 19
1.5.5. Connecting APIcast on other deployments 20
1.6. DEPLOYING 3SCALE USING THE OPERATOR 20
1.6.1. Deploying the APIManager custom resource 21
1.6.2. Getting the APIManager administrator credentials 21
1.6.3. Getting the Admin Portal URL 22
1.7. DEPLOYMENT CONFIGURATION OPTIONS FOR 3SCALE ON OPENSHIFT USING THE OPERATOR 22
1.7.1. Default deployment configuration 22
1.7.2. Evaluation installation 23
1.7.3. External databases installation 23
1.7.3.1. Backend Redis secret 24
1.7.3.2. System Redis secret 24
1.7.3.3. System database secret 25
1.7.3.4. APIManager custom resource 25
1.7.4. Amazon Simple Storage Service 3scale Filestorage installation 25
1.7.4.1. Amazon S3 secret 25
1.7.5. PostgreSQL installation 26
1.7.6. Reconciliation 26
1.7.6.1. Resources 27
1.7.6.2. Backend replicas 27
1.7.6.3. APIcast replicas 27
1.7.6.4. System replicas 28
1.8. TROUBLESHOOTING COMMON 3SCALE INSTALLATION ISSUES 28
1.8.1. Previous deployment leaving dirty persistent volume claims 28
1.8.2. Incorrectly pulling from the Docker registry 29
1.8.3. Permission issues for MySQL when persistent volumes are mounted locally 29
1.8.4. Unable to upload logo or images 30
1.8.5. Test calls not working on OpenShift 30
1.8.6. APIcast on a different project from 3scale failing to deploy 30
.CHAPTER
. . . . . . . . . . 2.
. . INSTALLING
. . . . . . . . . . . . . .APICAST
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32
..............
2.1. APICAST DEPLOYMENT OPTIONS 32
2.2. APICAST ENVIRONMENTS 32
2.3. CONFIGURING THE INTEGRATION SETTINGS 33
1
Red Hat 3scale API Management 2.8 Installing 3scale
.CHAPTER
. . . . . . . . . . 3.
. . RUNNING
. . . . . . . . . . . APICAST
. . . . . . . . . .ON
. . . .RED
. . . . .HAT
. . . . OPENSHIFT
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42
..............
3.1. SETTING UP RED HAT OPENSHIFT 42
3.1.1. Installing the Docker containerized environment 42
3.1.2. Starting the OpenShift cluster 43
3.1.3. Setting up the OpenShift cluster on a remote server (Optional) 44
3.2. DEPLOYING APICAST USING THE OPENSHIFT TEMPLATE 44
3.3. CREATING ROUTES VIA THE OPENSHIFT CONSOLE 45
. . . . . . . . . . . 4.
CHAPTER . . .DEPLOYING
. . . . . . . . . . . . .APICAST
. . . . . . . . . .ON
. . . THE
. . . . . DOCKER
. . . . . . . . . .CONTAINERIZED
. . . . . . . . . . . . . . . . . .ENVIRONMENT
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
..............
4.1. INSTALLING THE DOCKER CONTAINERIZED ENVIRONMENT 48
4.2. RUNNING THE DOCKER CONTAINERIZED ENVIRONMENT GATEWAY 49
4.2.1. The docker command options 49
4.2.2. Testing APIcast 50
4.3. ADDITIONAL RESOURCES 50
. . . . . . . . . . . 5.
CHAPTER . . DEPLOYING
. . . . . . . . . . . . . .APICAST
. . . . . . . . . .ON
. . . PODMAN
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
..............
5.1. INSTALLING THE PODMAN CONTAINER ENVIRONMENT 51
5.2. RUNNING THE PODMAN ENVIRONMENT 51
5.2.1. Testing APIcast with Podman 52
5.3. THE PODMAN COMMAND OPTIONS 52
5.4. ADDITIONAL RESOURCES 52
.CHAPTER
. . . . . . . . . . 6.
. . .INSTALLING
. . . . . . . . . . . . .THE
. . . . .3SCALE
. . . . . . . . .OPERATOR
. . . . . . . . . . . . ON
. . . .OPENSHIFT
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53
..............
6.1. CREATING A NEW OPENSHIFT PROJECT 53
6.2. INSTALLING AND CONFIGURING THE 3SCALE OPERATOR USING THE OLM 54
.CHAPTER
. . . . . . . . . . 7.
. . 3SCALE
. . . . . . . . . HIGH
. . . . . . AVAILABILITY
. . . . . . . . . . . . . . . AND
. . . . . .EVALUATION
. . . . . . . . . . . . . . TEMPLATES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56
..............
7.1. HIGH AVAILABILITY TEMPLATE 56
7.1.1. Setting RWX_STORAGE_CLASS for high availability 57
7.2. EVALUATION TEMPLATE 57
.CHAPTER
. . . . . . . . . . 8.
. . .REDIS
. . . . . . HIGH
. . . . . . AVAILABILITY
. . . . . . . . . . . . . . . (HA)
. . . . . .SUPPORT
. . . . . . . . . . .FOR
. . . . .3SCALE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .58
..............
8.1. SETTING UP REDIS FOR ZERO DOWNTIME 58
8.2. CONFIGURING BACK-END COMPONENTS FOR 3SCALE 59
8.2.1. Creating backend-redis and system-redis secrets 59
8.2.2. Deploying a fresh installation of 3scale for HA 59
8.2.3. Migrating a non-HA deployment of 3scale to HA 60
2
Table of Contents
.CHAPTER
. . . . . . . . . . 9.
. . .CONFIGURING
. . . . . . . . . . . . . . . AN
. . . .EXTERNAL
. . . . . . . . . . . .MYSQL
. . . . . . . . DATABASE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63
..............
9.1. EXTERNAL MYSQL DATABASE LIMITATIONS 63
9.2. EXTERNALIZING THE MYSQL DATABASE 63
9.3. ROLLING BACK 67
9.4. ADDITIONAL INFORMATION 67
. . . . . . . . . . . 10.
CHAPTER . . . SETTING
. . . . . . . . . . UP
. . . .YOUR
. . . . . . 3SCALE
. . . . . . . . . SYSTEM
. . . . . . . . . IMAGE
. . . . . . . .WITH
. . . . . .AN
. . . .ORACLE
. . . . . . . . .DATABASE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .68
..............
10.1. PREPARING THE ORACLE DATABASE 68
10.2. BUILDING THE SYSTEM IMAGE 69
3
Red Hat 3scale API Management 2.8 Installing 3scale
4
PREFACE
PREFACE
This guide will help you to install and configure 3scale
5
Red Hat 3scale API Management 2.8 Installing 3scale
The Red Hat 3scale API Management solution for on-premises deployment is composed of:
One 3scale Admin Portal and Developer Portal with persistent storage
NOTE
Whether deploying 3scale using the operator or via templates, you must first configure
registry authentication to the Red Hat container registry. See Section 1.3.1, “Configuring
registry authentication in OpenShift”.
Prerequisites
You must configure 3scale servers for UTC (Coordinated Universal Time).
To install 3scale on OpenShift, perform the steps outlined in the following sections:
Environment requirements
Red Hat 3scale API Management requires an environment specified in supported configurations.
Persistent volumes
6
CHAPTER 1. INSTALLING 3SCALE ON OPENSHIFT
Configure the RWX persistent volume to be group writable. For a list of persistent volume types that
support the required access modes, see the OpenShift documentation.
Hardware requirements
Hardware requirements depend on your usage needs. Red Hat recommends that you test and
configure your environment to meet your specific requirements. The following are the
recommendations when configuring your environment for 3scale on OpenShift:
Very large installations may require a separate node (AWS M4 series or Azure Av2 series) for
Redis if memory requirements exceed your current node’s available RAM.
Set the PUMA_WORKERS variable of the back-end listener to the number of cores in your
compute node.
Procedure
2. Register your nodes with Red Hat using the Red Hat Subscription Manager (RHSM), via the
interface or the command line.
7
Red Hat 3scale API Management 2.8 Installing 3scale
NOTE
OpenShift Container Platform (OCP) 4.x supports deployment of 3scale using the
operator only. See Deploying 3scale using the operator .
Prerequisites
NOTE
Procedure
oc login -u system:admin
2. Log in to the OpenShift project where you will be installing the image streams. Red Hat
recommends that you use the openshift project for the 3scale OpenShift image streams.
Note: It will have a prefix that is a fixed, random string.
oc project your-openshift-project
8
CHAPTER 1. INSTALLING 3SCALE ON OPENSHIFT
3. Create a docker-registry secret using the credentials you created in Creating registry service
accounts.
NOTE
Create a docker-registry secret for every new namespace where the image
streams reside and which use registry.redhat.io.
NOTE
It is a requirement for 3scale 2.8 that you follow the steps outlined below before
deploying either on OpenShift using a template or via the operator, as both options use
registry authentication.
Procedure
3. Fill in the form on the Create a New Registry Service Account page.
4. Enter a Description.
5. Click Create.
8. Make a note of the username, including the prefix string, for example 12345678|username, and
your password.
9
Red Hat 3scale API Management 2.8 Installing 3scale
NOTE
There are tabs available on the Token Information page that show you how to use the
authentication token. For example, the Token Information tab shows the username in the
format 12345678|username and the password string below it.
WARNING
The regeneration or removal of service accounts will impact systems that are using
the token to authenticate and retrieve content from registry.redhat.io.
Regenerate token: Allows an authorized user to reset the password associated with the Service
Account.
Note: The username for the Service Account cannot be changed.
Update Description: Allows an authorized user to update the description for the Service
Account.
Additional resources
NOTE
When API providers are created, updated, or deleted, routes automatically reflect
those changes.
Perform the following steps to import the 3scale template into your OpenShift cluster:
Procedure
10
CHAPTER 1. INSTALLING 3SCALE ON OPENSHIFT
oc login
oc project <project_name>
oc new-project <project_name>
a. Specify the --file option with the path to the amp.yml file you downloaded as part of
Configuring nodes and entitlements.
b. Specify the --param option with the WILDCARD_DOMAIN parameter set to the domain of
your OpenShift cluster:
The terminal shows the master and tenant URLs and credentials for your newly created
3scale Admin Portal. This output should include the following information:
master password
tenant username
tenant password
* With parameters:
* ADMIN_PASSWORD=xXxXyz123 # generated
* ADMIN_USERNAME=admin
* TENANT_NAME=user
* MASTER_NAME=master
* MASTER_USER=master
* MASTER_PASSWORD=xXxXyz123 # generated
--> Success
Access your application via route 'user-admin.3scale-project.example.com'
Access your application via route 'master-admin.3scale-project.example.com'
Access your application via route 'backend-user.3scale-project.example.com'
Access your application via route 'user.3scale-project.example.com'
Access your application via route 'api-user-apicast-staging.3scale-project.example.com'
Access your application via route 'api-user-apicast-production.3scale-project.example.com'
11
Red Hat 3scale API Management 2.8 Installing 3scale
NOTE
Wait for 3scale to fully deploy on OpenShift for your login and credentials to
work.
The 3scale Dashboard shows the new portal URL of the tenant. As an example, if the <wildCardDomain>
is 3scale-project.example.com, the Admin Portal URL is: https://3scale-admin.3scale-
project.example.com.
The wildcardDomain is the <wildCardDomain> parameter you provided during installation. Open this
unique URL in a browser using the this command:
xdg-open https://3scale-admin.3scale-project.example.com
Optionally, you can create new tenants on the MASTER portal URL: `master.${wildcardDomain}
Perform the following steps to configure the SMTP variables in the SMTP config map:
Procedure
oc login
a. Using the oc patch command, specify the secret type where system-smtp is the name of
the secret, followed by the -p option, and write the new values in JSON for the following
variables:
Variable Description
12
CHAPTER 1. INSTALLING 3SCALE ON OPENSHIFT
Variable Description
Example
2. After you have set the secret variables, redeploy the system-app and system-sidekiq pods:
13
Red Hat 3scale API Management 2.8 Installing 3scale
14
CHAPTER 1. INSTALLING 3SCALE ON OPENSHIFT
15
Red Hat 3scale API Management 2.8 Installing 3scale
16
CHAPTER 1. INSTALLING 3SCALE ON OPENSHIFT
This section explains how to deploy APIcast with API Manager on OpenShift.
Connecting multiple APIcast deployments on a single OpenShift cluster over internal service
routes
Perform the following steps to deploy additional API gateways on your OpenShift cluster:
Procedure
oc login
3. Create a secret that allows APIcast to communicate with 3scale. Specify new-basicauth,
apicast-configuration-url-secret, and the --password parameter with the access token,
tenant name, and wildcard domain of your 3scale deployment:
17
Red Hat 3scale API Management 2.8 Installing 3scale
NOTE
TENANT_NAME is the name under the root that the Admin Portal will be
available with. The default value for TENANT_NAME is 3scale. If you used a
custom value in your 3scale deployment, you must use that value here.
4. Import the APIcast template using the oc new-app command, specifying the --file option with
the apicast.yml file:
NOTE
Procedure
oc login
3. Create a secret that allows APIcast to communicate with 3scale. Specify new-basicauth,
apicast-configuration-url-secret, and the --password parameter with the access token,
tenant name, and wildcard domain of your 3scale deployment:
NOTE
TENANT_NAME is the name under the root that the Admin Portal will be
available with. The default value for TENANT_NAME is 3scale. If you used a
custom value in your 3scale deployment, you must use that value.
4. Deploy APIcast on a different OpenShift cluster using the oc new-app command. Specify the --
18
CHAPTER 1. INSTALLING 3SCALE ON OPENSHIFT
4. Deploy APIcast on a different OpenShift cluster using the oc new-app command. Specify the --
file option and the to path to your apicast.yml file:
In embedded APIcast deployments, 3scale and APIcast are deployed from a single template. You must
modify environment variables after deployment if you wish to change the default behavior for the
embedded APIcast deployments.
You must have an OpenShift Software-Defined Networking (SDN) plugin installed to connect over
internal service routes. How you connect depends on which SDN you have installed:
ovs-subnet
If you are using the ovs-subnet OpenShift SDN plugin, perform the following steps to connect over
internal routes:
Procedure
oc login
oc route backend-listener
oc new-app -f apicast.yml
ovs-multitenant
If you are using the ovs-multitenant OpenShift SDN plugin, perform the following steps to connect
over internal routes:
Procedure
oc login
19
Red Hat 3scale API Management 2.8 Installing 3scale
2. As administrator, specify the oadm command with the pod-network and join-projects options
to set up communication between both projects:
oc route backend-listener
oc new-app -f apicast.yml
Additional resources
For information on OpenShift SDN and project network isolation, see Openshift SDN.
Additional resources
For more details, see Deploying APIcast on the Docker containerized environment .
NOTE
When API providers are created, updated, or deleted, routes automatically reflect
those changes.
Prerequisites
Deploying 3scale using the operator first requires that you follow the steps in Chapter 6,
Installing the 3scale Operator on OpenShift
For more information about supported configurations, see the Red Hat 3scale API
20
CHAPTER 1. INSTALLING 3SCALE ON OPENSHIFT
For more information about supported configurations, see the Red Hat 3scale API
Management Supported Configurations page.
Procedure
4. Clear the sample content and add the following YAML definitions to the editor, then click
Create.
NOTE
The wildcardDomain parameter can be any desired name you wish to give that
resolves to an IP address, which is a valid DNS domain. Be sure to remove the
placeholder marks for your parameters: < >.
apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
name: example-apimanager
spec:
wildcardDomain: <wildcardDomain>
resourceRequirementsEnabled: true
21
Red Hat 3scale API Management 2.8 Installing 3scale
Additional resources
For more information about the APIManager fields, refer to the Reference documentation.
The 3scale Dashboard shows the new portal URL of the tenant. As an example, if the <wildCardDomain>
is 3scale-project.example.com, the Admin Portal URL is: https://3scale-admin.3scale-
project.example.com.
The wildcardDomain is the <wildCardDomain> parameter you provided during installation. Open this
unique URL in a browser using the this command:
xdg-open https://3scale-admin.3scale-project.example.com
Optionally, you can create new tenants on the MASTER portal URL: master.${wildcardDomain}
Prerequisites
Deploying 3scale using the operator first requires that you follow the steps in Chapter 6,
Installing the 3scale Operator on OpenShift
22
CHAPTER 1. INSTALLING 3SCALE ON OPENSHIFT
The default configuration option is suitable for proof of concept (PoC) or evaluation by a customer.
One, many, or all of the default configuration options can be overriden with specific field values in the
APIManager custom resource. The 3scale operator allows all available combinations whereas templates
allow fixed deployment profiles. For example, the 3scale operator allows deployment of 3scale in
evaluation mode and external databases mode. Templates do not allow this specific deployment
configuration. Templates are only available for the most common configuration options.
Fast startup
Runnable on laptop
apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
name: example-apimanager
spec:
wildcardDomain: lvh.me
resourceRequirementsEnabled: false
IMPORTANT
When enabling the 3scale external databases installation mode, all of the following
databases are externalized:
backend-redis
system-redis
3scale 2.8 and above has been tested is supported with the following database versions:
Database Version
Redis 5.0
23
Red Hat 3scale API Management 2.8 Installing 3scale
Database Version
MySQL 5.7
PostgreSQL 10.6
Before creating APIManager custom resource to deploy 3scale, you must provide the following
connection settings for the external databases using OpenShift secrets.
Deploy two external Redis instances and fill in the connection settings as shown in the following
example:
apiVersion: v1
kind: Secret
metadata:
name: backend-redis
stringData:
REDIS_STORAGE_URL: "redis://backend-redis-storage"
REDIS_STORAGE_SENTINEL_HOSTS: "redis://sentinel-0.example.com:26379,redis://sentinel-
1.example.com:26379, redis://sentinel-2.example.com:26379"
REDIS_STORAGE_SENTINEL_ROLE: "master"
REDIS_QUEUES_URL: "redis://backend-redis-queues"
REDIS_QUEUES_SENTINEL_HOSTS: "redis://sentinel-0.example.com:26379,redis://sentinel-
1.example.com:26379, redis://sentinel-2.example.com:26379"
REDIS_QUEUES_SENTINEL_ROLE: "master"
type: Opaque
Deploy two external Redis instances and fill in the connection settings as shown in the following
example:
apiVersion: v1
kind: Secret
metadata:
name: system-redis
stringData:
URL: "redis://system-redis"
SENTINEL_HOSTS: "redis://sentinel-0.example.com:26379,redis://sentinel-1.example.com:26379,
redis://sentinel-2.example.com:26379"
SENTINEL_ROLE: "master"
NAMESPACE: ""
MESSAGE_BUS_URL: "redis://system-redis-messagebus"
MESSAGE_BUS_SENTINEL_HOSTS: "redis://sentinel-0.example.com:26379,redis://sentinel-
1.example.com:26379, redis://sentinel-2.example.com:26379"
24
CHAPTER 1. INSTALLING 3SCALE ON OPENSHIFT
MESSAGE_BUS_SENTINEL_ROLE: "master"
MESSAGE_BUS_NAMESPACE: ""
type: Opaque
Deploy a system database secret MySQL or PostgreSQL database instance and fill in the connection
settings as shown in the following example:
apiVersion: v1
kind: Secret
metadata:
name: system-database
stringData:
URL: "mysql2://root:password0@system-mysql/system"
DB_USER: "mysql"
DB_PASSWORD: "password1"
type: Opaque
apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
name: example-apimanager
spec:
wildcardDomain: lvh.me
highAvailability:
enabled: true
Before creating APIManager custom resource to deploy 3scale, connection settings for the S3 service
needs to be provided using an openshift secret.
In the following example, Secret name can be anyone, as it will be referenced in the APIManager custom
resource.
25
Red Hat 3scale API Management 2.8 Installing 3scale
kind: Secret
metadata:
creationTimestamp: null
name: aws-auth
stringData:
AWS_ACCESS_KEY_ID: 123456
AWS_SECRET_ACCESS_KEY: 98765544
AWS_BUCKET: mybucket.example.com
AWS_REGION: eu-west-1
type: Opaque
apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
name: example-apimanager
spec:
wildcardDomain: lvh.me
system:
fileStorage:
simpleStorageService:
configurationSecretRef:
name: aws-auth
NOTE
Amazon S3 region and Amazon S3 bucket settings are provided directly in the
APIManager custom resource. The Amazon S3 secret name is provided directly in the
APIManager custom resource.
apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
name: example-apimanager
spec:
wildcardDomain: lvh.me
system:
database:
postgresql: {}
1.7.6. Reconciliation
Once 3scale has been installed, the 3scale operator enables updating a given set of parameters from
26
CHAPTER 1. INSTALLING 3SCALE ON OPENSHIFT
Once 3scale has been installed, the 3scale operator enables updating a given set of parameters from
the custom resource to modify system configuration options. Modifications are made by hot swapping,
that is, without stopping or shutting down the system.
Not all the parameters of the APIManager custom resource definitions (CRDs) are reconcilable.
1.7.6.1. Resources
apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
name: example-apimanager
spec:
ResourceRequirementsEnabled: true/false
apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
name: example-apimanager
spec:
backend:
listenerSpec:
replicas: X
workerSpec:
replicas: Y
cronSpec:
replicas: Z
apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
name: example-apimanager
spec:
apicast:
27
Red Hat 3scale API Management 2.8 Installing 3scale
productionSpec:
replicas: X
stagingSpec:
replicas: Z
apiVersion: apps.3scale.net/v1alpha1
kind: APIManager
metadata:
name: example-apimanager
spec:
system:
appSpec:
replicas: X
sidekiqSpec:
replicas: Z
Permission issues for MySQL when persistent volumes are mounted locally
A previous deployment attempt leaves a dirty Persistent Volume Claim (PVC) causing the MySQL
container to fail to start.
Cause
Deleting a project in OpenShift does not clean the PVCs associated with it.
Solution
Procedure
1. Find the PVC containing the erroneous MySQL data with the oc get pvc command:
# oc get pvc
28
CHAPTER 1. INSTALLING 3SCALE ON OPENSHIFT
2. Stop the deployment of the system-mysql pod by clicking cancel deployment in the OpenShift
UI.
svc/system-redis - 1EX.AMP.LE.IP:6379
dc/system-redis deploys docker.io/rhscl/redis-32-rhel7:3.2-5.3
deployment #1 failed 13 minutes ago: config change
Cause
OpenShift searches for and pulls container images by issuing the docker command. This command
refers to the docker.io Docker registry instead of the registry.redhat.io Red Hat container registry.
This occurs when the system contains an unexpected version of the Docker containerized environment.
Solution
Procedure
Use the appropriate version of the Docker containerized environment.
1.8.3. Permission issues for MySQL when persistent volumes are mounted locally
Problem
The system-msql pod crashes and does not deploy causing other systems dependant on it to fail
deployment. The pod log displays the following error:
Cause
Solution
Procedure
1. The directories used for the persistent volumes MUST have the write permissions for the root
29
Red Hat 3scale API Management 2.8 Installing 3scale
1. The directories used for the persistent volumes MUST have the write permissions for the root
group. Having read-write permissions for the root user is not enough as the MySQL service runs
as a different user in the root group. Execute the following command as the root user:
Cause
Solution
Procedure
Ensure your persistent volume is writable by OpenShift. It should be owned by root group and be group
writable.
Test calls do not work after creation of a new service and routes on OpenShift. Direct calls via curl also
fail, stating: service not available.
Cause
3scale requires HTTPS routes by default, and OpenShift routes are not secured.
Solution
Procedure
Ensure the secure route checkbox is clicked in your OpenShift router settings.
APIcast deploy fails (pod does not turn blue). You see the following error in the logs:
update acceptor rejected apicast-3: pods for deployment "apicast-3" took longer than 600 seconds to
become ready
30
CHAPTER 1. INSTALLING 3SCALE ON OPENSHIFT
Error synching pod, skipping: failed to "StartContainer" for "apicast" with RunContainerError:
"GenerateRunContainerOptions: secrets \"apicast-configuration-url-secret\" not found"
Cause
Solution
Procedure
When creating a secret with APIcast v3, specify apicast-configuration-url-secret:
31
Red Hat 3scale API Management 2.8 Installing 3scale
In this guide you will learn about deployment options, environments provided, and how to get started.
Prerequisites
APIcast is not a standalone API gateway. It needs connection to 3scale API Manager.
Section 2.6, “Deploying an APIcast gateway self-managed solution using the operator”
Embedded APIcast: Two APIcast gateways (staging and production) come by default with the
3scale API Management installation. They come pre-configured and ready to use out-of-the-
box.
Self-managed APIcast: You can deploy APIcast wherever you want. Here are a few
recommended options to deploy APIcast:
Staging: Intended to be used only while configuring and testing your API integration. When you
32
CHAPTER 2. INSTALLING APICAST
have confirmed that your setup is working as expected, then you can choose to deploy it to the
production environment. The OpenShift template sets the parameters of the Staging APIcast in
a way that the configuration is reloaded on each API call
(APICAST_CONFIGURATION_LOADER: lazy, APICAST_CONFIGURATION_CACHE: 0). It is
useful to test the changes in APIcast configuration quickly.
Production: This environment is intended for production use. The following parameters are set
for the Production APIcast in the OpenShift template: APICAST_CONFIGURATION_LOADER:
boot, APICAST_CONFIGURATION_CACHE: 300. This means that the configuration will be
fully loaded when APIcast is started, and will be cached for 300 seconds (5 minutes). After 5
minutes the configuration will be reloaded. This means that when you promote the configuration
to production, it may take up to 5 minutes to be applied, unless you trigger a new deployment of
APIcast.
You can change these settings by clicking on edit integration settings in the upper-right corner.
In this example, you will use the Echo API hosted by 3scale, a simple API that accepts any path and
returns information about the request (path, request parameters, headers, etc.). Its Private Base URL is
https://echo-api.3scale.net:443.
Procedure
Test your private (unmanaged) API is working. For example, for the Echo API you can make the
33
Red Hat 3scale API Management 2.8 Installing 3scale
Test your private (unmanaged) API is working. For example, for the Echo API you can make the
following call with curl command:
curl "https://echo-api.3scale.net:443"
{
"method": "GET",
"path": "/",
"args": "",
"body": "",
"headers": {
"HTTP_VERSION": "HTTP/1.1",
"HTTP_HOST": "echo-api.3scale.net",
"HTTP_ACCEPT": "*/*",
"HTTP_USER_AGENT": "curl/7.51.0",
"HTTP_X_FORWARDED_FOR": "2.139.235.79, 10.0.103.58",
"HTTP_X_FORWARDED_HOST": "echo-api.3scale.net",
"HTTP_X_FORWARDED_PORT": "443",
"HTTP_X_FORWARDED_PROTO": "https",
"HTTP_FORWARDED": "for=10.0.103.58;host=echo-api.3scale.net;proto=https"
},
"uuid": "ee626b70-e928-4cb1-a1a4-348b8e361733"
}
Field Description
Auth user key Set the user key associated with the credentials
location
34
CHAPTER 2. INSTALLING APICAST
Field Description
Procedure
2. Enter a path existing in your API in the API test GET request field (for example,
/v1/word/good.json).
3. Save the settings by clicking on the Update & Test Staging Configurationbutton in the
bottom right part of the page.
a. This will deploy the APIcast configuration to the 3scale Hosted staging environment. If
everything is configured correctly, the vertical line on the left should turn green.
NOTE
If you are using one of the Self-managed deployment options, save the
configuration from the GUI and make sure it is pointing to your deployed API
gateway by adding the correct host in the staging or production public base
URL field. Before making any calls to your production gateway, do not forget
to click on the Promote v.x to Production button.
4. Find the sample curl at the bottom of the staging section and run it from the console:
curl "https://XXX.staging.apicast.io:443/v1/word/good.json?user_key=YOUR_USER_KEY"
NOTE
You should get the same response as above, however, this time the request will
go through the 3scale hosted APIcast instance. Note: You should make sure you
have an application with valid credentials for the service. If you are using the
default API service created on sign up to 3scale, you should already have an
application. Otherwise, if you see USER_KEY or APP_ID and APP_KEY values in
the test curl, you need to create an application for this service first.
3scale Hosted APIcast gateway does the validation of the credentials and applies the rate limits that you
defined for the application plan of the application. If you try to make a call without credentials, or with
invalid credentials, you will see an error message.
This guide provides steps for installing the APIcast operator through the OpenShift Container Platform
35
Red Hat 3scale API Management 2.8 Installing 3scale
This guide provides steps for installing the APIcast operator through the OpenShift Container Platform
(OCP) console.
Procedure
4. Type apicast in the Filter by keyword box to find the APIcast operator. Do not use the
community version.
5. Click the APIcast operator. You will see information about the APIcast operator.
7. Click Subscribe to accept all of the default selections on the Create Operator Subscription page.
8. Click Operators > Installed Operators to verify that the APIcast operator
ClusterServiceVersion (CSV) status displays to InstallSucceeded in the operator-test project.
Prerequisites
You must first follow the steps in Installing the APIcast operator .
Procedure
36
CHAPTER 2. INSTALLING APICAST
Procedure
1. Create an OpenShift secret that contains 3scale System Admin Portal endpoint information:
${SOME_SECRET_NAME} is the name of the secret and can be any name you want as long
as it does not conflict with an existing secret.
${MY_3SCALE_URL} is the URI that includes your 3scale access token and 3scale System
portal endpoint.
Example
For more information about the contents of the secret see the Admin portal configuration
secret reference.
apiVersion: apps.3scale.net/v1alpha1
kind: APIcast
metadata:
name: example-apicast
spec:
adminPortalCredentialsRef:
name: SOME_SECRET_NAME
3. Verify the APIcast pod is running and ready, by confirming that the readyReplicas field of the
OpenShift Deployment associated with the APIcast object is 1. Alternatively, wait until the field
is set with:
Procedure
1. Ensure the OpenShift Service APIcast is exposed to your local machine, and perform a test
request. Do this by port-forwarding the APIcast OpenShift Service to localhost:8080:
2. Make a request to a configured 3scale service to verify a successful HTTP response. Use the
37
Red Hat 3scale API Management 2.8 Installing 3scale
2. Make a request to a configured 3scale service to verify a successful HTTP response. Use the
domain name configured in Staging Public Base URL or Production Public Base URL
settings of your service. For example:
To expose APIcast externally via a Kubernetes Ingress, set and configure the exposedHost section
When the host field in the exposedHost section is set, this creates a Kubernetes Ingress object. The
Kubernetes Ingress object can then be used by a previously installed and existing Kubernetes Ingress
Controller to make APIcast accessible externally.
To learn what Ingress Controllers are available to make APIcast externally accessible and how they are
configured see the Kubernetes Ingress Controllers documentation .
apiVersion: apps.3scale.net/v1alpha1
kind: APIcast
metadata:
name: example-apicast
spec:
...
exposedHost:
host: "myhostname.com"
...
The example creates a Kubernetes Ingress object on the port 80 using HTTP. When the APIcast
deployment is in an OpenShift environment, the OpenShift default Ingress Controller will create a Route
object using the Ingress object APIcast creates which allows external access to the APIcast installation.
You may also configure TLS for the exposedHost section. Details about the available fields in the
exposedHost section can be found in the APIcast Custom Resource reference documentation.
Procedure
$ curl
https://raw.githubusercontent.com/3scale/APIcast/master/examples/configuration/echo.json -
o $PWD/config.json
The configuration file must be called config.json. This is an APIcast CRD reference
requirement.
For more information about the contents of the secret see the Admin portal configuration
secret reference.
38
CHAPTER 2. INSTALLING APICAST
$ cat my-echo-apicast.yaml
apiVersion: apps.3scale.net/v1alpha1
kind: APIcast
metadata:
name: my-echo-apicast
spec:
exposedHost:
host: YOUR DOMAIN
embeddedConfigurationSecretRef:
name: apicast-echo-api-conf-secret
$ oc apply -f my-echo-apicast.yaml
apiVersion: v1
kind: Secret
metadata:
name: SOME_SECRET_NAME
type: Opaque
stringData:
config.json: |
{
"services": [
{
"proxy": {
"policy_chain": [
{ "name": "apicast.policy.upstream",
"configuration": {
"rules": [{
"regex": "/",
"url": "http://echo-api.3scale.net"
}]
}
}
]
}
}
]
}
apiVersion: apps.3scale.net/v1alpha1
kind: APIcast
metadata:
name: example-apicast
spec:
embeddedConfigurationSecretRef:
name: SOME_SECRET_NAME
4. Verify the APIcast pod is running and ready, by confirming that the readyReplicas field of the
39
Red Hat 3scale API Management 2.8 Installing 3scale
4. Verify the APIcast pod is running and ready, by confirming that the readyReplicas field of the
OpenShift Deployment associated with the APIcast object is 1. Alternatively, wait until the field
is set with:
Procedure
1. Ensure the OpenShift Service APIcast is exposed to your local machine, and perform a test
request. Do this by port-forwarding the APIcast OpenShift Service to localhost:8080:
2. Make a request to a configured 3scale Service to verify a successful HTTP response. Use the
domain name configured in Staging Public Base URL or Production Public Base URL
settings of your service. For example:
The following list are points to consider in if you are planning to implement WebSocket protocols:
The WebSocket protocol does not support JSON Web Token (JWT).
40
CHAPTER 2. INSTALLING APICAST
"policy_chain": [
{ "name": "apicast.policy.websocket" },
{ "name": "apicast.policy.apicast" }
],
NOTE
You cannot use api_key authorization. Use JSON Web Token (JWT) or Headers
instead.
The gRPC policy (HTTP/2) must be above the APIcast policy in the policy chain.
In HTTP/2 endpoints, where the policy is used, there are some constraints:
The endpoint needs to listen on TLS in case this policy does not work expected.
gRPC full flow will only work if the TLS policy is enabled.
"policy_chain": [
{ "name": "apicast.policy.grpc" },
{ "name": "apicast.policy.apicast" }
],
41
Red Hat 3scale API Management 2.8 Installing 3scale
Prerequisites
You must configure APIcast in your Red Hat 3scale API Management Admin Portal as per
Chapter 2, Installing APIcast.
Make sure Self-managed Gateway is selected as the deployment option in the integration
settings.
You should have both staging and production environment configured to proceed.
To run APIcast on Red Hat OpenShift, perform the steps outlined in the following sections:
For production deployments you can follow the instructions for OpenShift installation.
For a RHEL 7 deployed on a AWS EC2 instance you will use the following the instructions:
Procedure
42
CHAPTER 3. RUNNING APICAST ON RED HAT OPENSHIFT
INSECURE_REGISTRY='--insecure-registry 172.30.0.0/16'
6. Verify that the container service is running with the following command:
Procedure
NOTE
The docker command runs as the root user, so you will need to run any oc or
docker commands with root privileges.
2. Open a terminal with a user that has permission to run docker commands and run:
oc cluster up
At the bottom of the output you will find information about the deployed cluster:
43
Red Hat 3scale API Management 2.8 Installing 3scale
To login as administrator:
oc login -u system:admin
3. Note the IP address that is assigned to your OpenShift server. You will refer to it in the tutorial
as OPENSHIFT-SERVER-IP.
For example, if you are deploying on an AWS EC2 instance, you should specify the following options:
Procedure
1. By default you are logged in as developer and can proceed to the next step.
Otherwise login into OpenShift using the oc login command from the OpenShift Client tools
you downloaded and installed in the previous step. The default login credentials are username =
"developer" and password = "developer":
oc login https://OPENSHIFT-SERVER-IP:8443
2. Create your project. This example sets the display name as gateway
Ignore the suggested next steps in the text output at the command prompt and proceed to the
next step below.
3. Create a new secret to reference your project by replacing <access_token> and <domain>
with your own credentials. See below for more information about the <access_token> and
<domain>.
44
CHAPTER 3. RUNNING APICAST ON RED HAT OPENSHIFT
Here <access_token> is an Access Token for the 3scale account, and <domain>-
admin.3scale.net is the URL of your 3scale Admin Portal.
secret/apicast-configuration-url-secret
4. Create an application for your APIcast gateway from the template, and start the deployment:
oc new-app -f https://raw.githubusercontent.com/3scale/3scale-amp-openshift-
templates/2.8.0.GA/apicast-gateway/apicast.yml
You should see the following messages at the bottom of the output:
Procedure
1. Open the web console for your OpenShift cluster in your browser: https://OPENSHIFT-
SERVER-IP:8443/console/
Use the value specified in --public-hostname instead of OPENSHIFT-SERVER-IP if you
started OpenShift cluster on a remote server.
NOTE
You may receive a warning about an untrusted website. This is expected, as you
are trying to access the web console through secure protocol, without having
configured a valid certificate. While you should avoid this in production
environment, for this test setup you can go ahead and create an exception for
this address.
2. Log in using the developer credentials created or obtained in the Setting up Red Hat OpenShift
section.
You will see a list of projects, including the gateway project you created from the command line
above.
45
Red Hat 3scale API Management 2.8 Installing 3scale
If you do not see your gateway project, you probably created it with a different user and will
need to assign the policy role to to this user.
3. Click on the gateway link and you will see the Overview tab.
OpenShift downloaded the code for APIcast and started the deployment. You may see the
message Deployment #1 running when the deployment is in progress.
When the build completes, the user interface (UI) will refresh and show two instances of APIcast
( 2 pods ) that have been started by OpenShift, as defined in the template.
Each APIcast instance, upon starting, downloads the required configuration from 3scale using
the settings you provided on the Integration page of your 3scale Admin Portal.
OpenShift will maintain two APIcast instances and monitor the health of both; any unhealthy
APIcast instance will automatically be replaced with a new one.
4. To allow your APIcast instances to receive traffic, you need to create a route. Start by clicking on
Create Route.
46
CHAPTER 3. RUNNING APICAST ON RED HAT OPENSHIFT
Enter the same host you set in 3scale above in the section Public Base URL (without the http://
and without the port) , e.g. gateway.openshift.demo, then click the Create button.
For every 3scale service you define, you must create a new route.
47
Red Hat 3scale API Management 2.8 Installing 3scale
NOTE
RHEL 7.7
Docker 1.13.1
Prerequisites
You must configure APIcast in your 3scale Admin Portal as per Chapter 2, Installing APIcast.
To create a registry service account, see Section 1.3.2, “Creating registry service accounts” .
To deploy APIcast on the docker containerized environment, perform the steps outlined in the following
sections:
The Docker container engine provided by Red Hat is released as part of the Extras channel in RHEL. To
enable additional repositories, you can use either the Subscription Manager or the yum-config-manager
option. For details, see the RHEL product documentation .
To deploy RHEL 7.x on an Amazon Web Services (AWS), Amazon Elastic Compute Cloud (Amazon EC2)
instance, take the following steps:
Procedure
4. Install the Docker containerized environment package: sudo yum install docker.
Additional resources
For other operating systems, refer to the following Docker documentation:
48
CHAPTER 4. DEPLOYING APICAST ON THE DOCKER CONTAINERIZED ENVIRONMENT
Procedure
You can download a ready to use Docker container engine image from the Red Hat registry:
Here, <access_token> is the Access Token for the 3scale Account Management API. You can
use the Provider Key instead of the access token. <domain>-admin.3scale.net is the URL of
your 3scale Admin Portal.
This command runs a Docker container engine called "apicast" on port 8080 and fetches the JSON
configuration file from your 3scale Admin Portal. For other configuration options, see Installing APIcast .
-d or --detach: Runs the container in the background and prints the container ID. When it is not
specified, the container runs in the foreground mode and you can stop it using CTRL + c. When
started in the detached mode, you can reattach to the container with the docker attach
command, for example, docker attach apicast.
-p or --publish: Publishes a container’s port to the host. The value should have the format
<host port="">:<container port="">, so -p 80:8080 will bind port 8080 of the container to port
80 of the host machine. For example, the Management API uses port 8090, so you may want to
publish this port by adding -p 8090:8090 to the docker run command.
49
Red Hat 3scale API Management 2.8 Installing 3scale
specify that the volume will be read only (by default, it is mounted in read-write mode).
Example: -v /host/path:/container/path:ro.
Test calls will not only verify that APIcast is running correctly but also that authentication and reporting
is being handled successfully.
NOTE
Ensure that the host you use for the calls is the same as the one configured in the Public
Base URL field on the Integration page.
Additional resources
50
CHAPTER 5. DEPLOYING APICAST ON PODMAN
NOTE
RHEL 8.x
Podman 1.4.2
Prerequisites
You must configure APIcast in your 3scale Admin Portal as per Chapter 2, Installing APIcast.
To create a registry service account, see Section 1.3.2, “Creating registry service accounts” .
To deploy APIcast on the Podman container environment, perform the steps outlined in the following
sections:
For more details about Podman with RHEL 8.x, see the Container command-line reference .
Procedure
Additional resources
For other operating systems, refer to the following Podman documentation:
Procedure
1. Download a ready to use Podman container image from the Red Hat registry:
podman pull registry.redhat.io/3scale-amp2/apicast-gateway-rhel8:3scale2.8
51
Red Hat 3scale API Management 2.8 Installing 3scale
Here, <access_token> is the Access Token for the 3scale Account Management API. You can
use the Provider Key instead of the access token. <domain>-admin.3scale.net is the URL of
your 3scale Admin Portal.
This command runs a Podman container engine called "apicast" on port 8080 and fetches the JSON
configuration file from your 3scale Admin Portal. For other configuration options, see Installing APIcast .
Test calls will not only verify that APIcast is running correctly but also that authentication and reporting
is being handled successfully.
NOTE
Ensure that the host you use for the calls is the same as the one configured in the Public
Base URL field on the Integration page.
-d: Runs the container in detached mode and prints the container ID. When it is not specified,
the container runs in the foreground mode and you can stop it using CTRL + c. When started in
the detached mode, you can reattach to the container with the podman attach command, for
example, podman attach apicast.
ps and -a: Podman ps is used to list creating and running containers. Adding -a to the ps
command will show all containers, both running and stopped, for example, podman ps -a.
inspect and -l: Inspect a running container. For example, use inspect to see the ID that was
assigned to the container. Use -l to get the details for the latest container, for example, podman
inspect -l | grep Id\":.
For information about getting started with Podman, see Basic Setup and Use of Podman .
52
CHAPTER 6. INSTALLING THE 3SCALE OPERATOR ON OPENSHIFT
NOTE
3scale supports the last two general availability (GA) releases of OpenShift Container
Platform (OCP). For more information, see the Red Hat 3scale API Management
Supported Configurations page.
Deploy the custom resources once the operator has been deployed.
Prerequisites
For more information about supported configurations, see the Red Hat 3scale API
Management Supported Configurations page.
WARNING
Deploy the 3scale operator and custom resource definitions (CRDs) in a separate
newly created, empty project. If you deploy them in an existing project containing
infrastructure, it could alter or delete existing elements.
To install the 3scale operator on OpenShift, perform the steps outlined in the following sections:
Section 6.2, “Installing and configuring the 3scale operator using the OLM”
Procedure
To create a new OpenShift project:
53
Red Hat 3scale API Management 2.8 Installing 3scale
Indicate a valid name using alphanumeric characters and dashes. As an example, run the
command below to create 3scale-project:
oc new-project 3scale-project
This creates the new OpenShift project where the operator, the APIManager custom resource (CR), and
the Capabilities custom resources will be installed. The operator manages the custom resources
through OLM in that project.
NOTE
You must install and deploy the 3scale operator in the project that you defined in
Creating a new OpenShift project .
Procedure
1. In the OpenShift Container Platform console, log in using an account with administrator
privileges.
2. The menu structure depends on the version of OpenShift you are using:
3. In the Filter by keyword box, type 3scale operator to find the 3scale operator.
5. Read the information about the operator and click Install. The Create Operator Subscription
page opens.
6. On the Create Operator Subscription page, accept all of the default selections and click
Subscribe.
NOTE
The operator will only be available in the specific single namespace on the cluster
that you have selected.
The 3scale-operator details page is displayed, where you can see the Subscription Overview.
8. Verify that the 3scale operator ClusterServiceVersion (CSV) is displayed, and the Status of the
operator ultimately resolves to InstallSucceeded in the project you defined in Creating a new
OpenShift project:
54
CHAPTER 6. INSTALLING THE 3SCALE OPERATOR ON OPENSHIFT
For OCP 4.2, click Operators > Installed Operators. In this case, successful installation will
register the APIManager CRD, and the CRDs related to the Capabilities functionality of the
operator in the OpenShift API server .
9. After successful installation, query the resource types defined by the CRDs via oc get.
a. For example, to verify that the APIManager CRD has been correctly registered, execute the
following command:
oc get apimanagers
No resources found.
Additional resources
For more information about supported configurations, see the Red Hat 3scale API Management
Supported Configurations page.
55
Red Hat 3scale API Management 2.8 Installing 3scale
Prerequisites
You need to have an available OpenShift cluster to deploy elements of the High Availability and
Evaluation templates.
IMPORTANT
The 3scale High Availability and Evaluation templates are a Technology Preview feature
only. Technology Preview features are not supported with Red Hat production service
level agreements (SLAs) and might not be functionally complete. Red Hat does not
recommend using them in production. These features provide early access to upcoming
product features, enabling customers to test functionality and provide feedback during
the development process. For more information about the support scope of Red Hat
Technology Preview features, see Technology Preview Features Support Scope .
To deploy High Availability and Evaluation templates, perform the steps outlined in the following
sections:
Prerequisites
Before deploying the HA template, you must deploy and configure the external databases, and
configure them in a HA configuration with a load-balanced endpoint.
Memcached
Sphinx
Zync
56
CHAPTER 7. 3SCALE HIGH AVAILABILITY AND EVALUATION TEMPLATES
Addition of the following mandatory parameters, allowing you the control of the location of
external databases:
BACKEND_REDIS_STORAGE_ENDPOINT
BACKEND_REDIS_QUEUES_ENDPOINT
SYSTEM_REDIS_URL
APICAST_STAGING_REDIS_URL
APICAST_PRODUCTION_REDIS_URL
SYSTEM_DATABASE_URL
required: false
value: null
Set this to null to signal OpenShift that you want the storage class to be auto-discovered (no
value).
If you set this to an empty string or no default value, it signals OpenShift that you want the
string storage empty. This is an invalid setting.
The only functional difference compared to the standard amp.yml template is that the resource limits
and requests have been removed. This means that in this version the minimum hardware requirements
have been removed on the pods at CPU and Memory level. This template is intended only for
evaluation, testing, and development purposes as it tries to deploy the components in a best-effort way
with the given hardware resources.
57
Red Hat 3scale API Management 2.8 Installing 3scale
NOTE
The information and procedures in this section is not officially supported by Red Hat. It is
for reference only.
The database components for HA in Red Hat 3scale API Management include:
system-redis: provides temporary storage for background jobs for 3scale and is also used as a
message bus for Ruby processes of system-app pods.
Both backend-redis and system-redis work with supported Redis high availability variants for Redis
Sentinel and Redis Enterprise.
If the Redis pod comes to a stop, or if the OpenShift Container Platform stops it, a new pod is
automatically created. Persistent storage will restore the data so the pod continues to work. In these
scenarios, there will be a small amount of downtime while the new pod starts. This is due to a limitation in
Redis that does not support a multi-master setup. You can reduce downtime by preinstalling the Redis
images onto all nodes that have Redis deployed to them. This will speed up the pod restart time.
To set up Redis for zero downtime and configure back-end components for 3scale, perform the steps
outlined in the following sections:
Amazon ElastiCache
Redis Labs
NOTE
58
CHAPTER 8. REDIS HIGH AVAILABILITY (HA) SUPPORT FOR 3SCALE
NOTE
Red Hat does not provide support for the above mentioned services. The mention of any
such services does not imply endorsement by Red Hat of the products or services. You
agree that Red Hat is not responsible or liable for any loss or expenses that may result
due to your use of (or reliance on) any external content.
NOTE
If you want to use Redis with sentinels, you must create the system-redis secret with all
fields in order to configure the Redis you want to point to before deploying 3scale. The
fields are not provided as parameters in the back end as of 3scale.
backend-redis
REDIS_QUEUES_SENTINEL_HOSTS
REDIS_QUEUES_SENTINEL_ROLE
REDIS_QUEUES_URL
REDIS_STORAGE_SENTINEL_HOSTS
REDIS_STORAGE_SENTINEL_ROLE
REDIS_STORAGE_URL
system-redis
MESSAGE_BUS_NAMESPACE
MESSAGE_BUS_SENTINEL_HOSTS
MESSAGE_BUS_SENTINEL_ROLE
MESSAGE_BUS_URL
NAMESPACE
SENTINEL_HOSTS
SENTINEL_ROLE
URL
When configuring for Redis with sentinels, the corresponding URL fields in backend-redis
and system-redis refer to the Redis group in the format redis://[:redis-password@]redis-
59
Red Hat 3scale API Management 2.8 Installing 3scale
group[/db]`, where [x] denotes optional element x and redis-password, redis-group, and
db are variables to be replaced accordingly:
Example
redis://:redispwd@mymaster/5
redis://:sentinel-password@sentinel-hostname-or-ip:port
For each element of the list, [x] denotes optional element x and sentinel-password,
sentinel-hostname-or-ip, and port are variables to be replaced accordingly:
Example
:[email protected]:2711,:sentinelpwd@other-sentinel:2722
2. Deploy 3scale as indicated in Deploying 3scale on OpenShift using a template , using the latest
version of the templates.
2. Make sure the following backend-redis environment variables are defined for the back-end
pods.
name: BACKEND_REDIS_SENTINEL_HOSTS
valueFrom:
secretKeyRef:
key: REDIS_STORAGE_SENTINEL_HOSTS
name: backend-redis
name: BACKEND_REDIS_SENTINEL_ROLE
valueFrom:
secretKeyRef:
key: REDIS_STORAGE_SENTINEL_ROLE
name: backend-redis
3. Make sure the following system-redis environment variables are defined for the system-
(app|sidekiq|sphinx) pods.
name: REDIS_SENTINEL_HOSTS
valueFrom:
secretKeyRef:
key: SENTINEL_HOSTS
name: system-redis
name: REDIS_SENTINEL_ROLE
60
CHAPTER 8. REDIS HIGH AVAILABILITY (HA) SUPPORT FOR 3SCALE
valueFrom:
secretKeyRef:
key: SENTINEL_ROLE
name: system-redis
name: MESSAGE_BUS_REDIS_SENTINEL_HOSTS
valueFrom:
secretKeyRef:
key: MESSAGE_BUS_SENTINEL_HOSTS
name: system-redis
name: MESSAGE_BUS_REDIS_SENTINEL_ROLE
valueFrom:
secretKeyRef:
key: MESSAGE_BUS_SENTINEL_ROLE
name: system-redis
4. Proceed with instructions to continue Upgrading 3scale 2.7 to 2.8 using templates .
1. Use Redis Enterprise deployed in OpenShift, with three different redis-enterprise instances:
ii. Set URL and MESSAGE_BUS_URL to the proper Redis group, for example:
redis://:redispwd@mymaster/5
REDIS_QUEUES_URL
REDIS_QUEUES_SENTINEL_ROLE
REDIS_QUEUES_SENTINEL_HOSTS
61
Red Hat 3scale API Management 2.8 Installing 3scale
REDIS_STORAGE_URL
REDIS_STORAGE_SENTINEL_ROLE
REDIS_STORAGE_SENTINEL_HOSTS
Notes
The system-app and system-sidekiq components connect directly to back-end Redis for
retrieving statistics.
As of 3scale 2.7, these system components can also connect to back-end Redis (storage)
when using sentinels.
The system-app and system-sidekiq components uses only backend-redis storage, not
backend-redis queues.
Changes made to the system components support backend-redis storage with sentinels.
62
CHAPTER 9. CONFIGURING AN EXTERNAL MYSQL DATABASE
The difference between this approach and the one in Chapter 7, 3scale High Availability and Evaluation
templates is that this provides a way for externalizing a MySQL database in case Red Hat 3scale API
Management was initially using the default amp.yml template.
NOTE
Red Hat supports 3scale configurations that use an external MySQL database. However,
the database itself is not within the scope of support.
Prerequisites
Access to an OpenShift Container Platform 3.11 cluster using an account with administrator
privileges.
A 3scale instance installation on the OpenShift cluster. See Chapter 1, Installing 3scale on
OpenShift.
To configure an external MySQL database for High Availability (HA), perform the steps outlined in the
following sections:
MySQL host
Use the IP address from the external MySQL database instead of the hostname or it will not resolve. For
example, use 1.1.1.1 instead of mysql.mydomain.com.
63
Red Hat 3scale API Management 2.8 Installing 3scale
WARNING
This will cause downtime in the environment while the process is ongoing.
Procedure
1. Login to the OpenShift node where your 3scale On-premises instance is hosted and change to
its project:
Replace <user>, <url>, and <3scale-project> with your own credentials and the project name.
2. Follow the steps below in the order shown to scale down all the pods. This will avoid loss of data.
apicast-wildcard-router and zync for versions before 3scale 2.6 or zync-que and zync for
3scale 2.6 and above.
system-app.
NOTE
The deployment configuration for each step can be scaled down at the same
time. For example, you could scale down apicast-wildcard-router and zync
together. However, it is better to wait for the pods from each step to
terminate before scaling down the ones that follow. The 3scale instance will
be completely inaccessible until it is fully started again.
3. To confirm that no pods are running on the 3scale project use the following command:
64
CHAPTER 9. CONFIGURING AN EXTERNAL MYSQL DATABASE
oc get pod
4. Scale up the database level pods again using the following command:
oc scale dc/{backend-redis,system-memcache,system-mysql,system-redis,zync-database} --
replicas=1
5. Ensure that you are able to login to the external MySQL database through the system-mysql
pod before proceeding with the next steps:
oc rsh system-mysql-<system_mysql_pod_id>
mysql -u root -p -h <host>
The user should always be root. For more information see External MySQL database
limitations.
a. The CLI will now display mysql>. Type exit, then press return. Type exit again at the
next prompt to go back to the OpenShift node console.
Validate that the file system-mysql-dump.sql contains a valid MySQL level dump as in the
following example:
$ head -n 10 system-mysql-dump.sql
-- MySQL dump 10.13 Distrib 5.7.24, for Linux (x86_64)
--
-- Host: localhost Database:
-- ------------------------------------------------------
-- Server version 5.7.24
7. Scale down the system-mysql pod and leave it with 0 (zero) replicas:
65
Red Hat 3scale API Management 2.8 Installing 3scale
9. Create a default 'user'@'%' on the remote MySQL database. It only needs to have SELECT
privileges. Also find its base64 equivalents:
DB_USER and DB_PASSWORD: Use the values from the previous step for both.
11. Send system-mysql-dump.sql to the remote database server and import the dump into it. Use
the command to import it:
12. Use the command below to send system-mysql-dump.sql to the remote database server and
import the dump into the server:
14. Use the following instructions to Start 3scale On-premises, which scales up all the pods in the
correct order.
system-app.
apicast-wildcard-router and zync for versions before 3scale 2.6 or zync-que and zync for
3scale 2.6 and above.
The following example shows how to perform this in the CLI for backend-redis, system-
memcache, system-mysql, system-redis, and zync-database:
66
CHAPTER 9. CONFIGURING AN EXTERNAL MYSQL DATABASE
The system-app pod should now be up and running without any issues.
15. After validation, scale back up the other pods in the order shown.
16. Backup the system-mysql DeploymentConfig object. You may delete after a few days once
you are sure everything is running properly. Deleting system-mysql DeploymentConfig avoids
any future confusion if this procedure is done again in the future.
1. Edit the secret system-database using the original values from system-database-
orig.bkp.yml. See [step-10]:
2. Scale down all the pods and then scale them back up again, including system-mysql. The
system-app pod and the other pods to be started after it should be up and running again. Run
the following command to confirm all pods are back up and running:
67
Red Hat 3scale API Management 2.8 Installing 3scale
NOTE
The Oracle Database is not supported with OCP version 4.2 and 4.3 when you are
performing an operator-only installation of 3scale.
For more information about supported configurations, see the Red Hat 3scale
API Management Supported Configurations page.
This section explains how a Red Hat 3scale API Management administrator sets up the 3scale system
image with an Oracle Database. By default, 3scale 2.8 has a component called system that stores
configuration data in a MySQL database. You can override the default database and store your
information in an external Oracle Database. Follow the steps in this chapter to build a custom system
container image with your own Oracle Database client binaries and deploy 3scale to OpenShift.
Prerequisites
A supported version of the following Oracle software components:
Example packages
instantclient-basiclite-linux.x64-12.2.0.1.0.zip or instantclient-basic-linux.x64-12.2.0.1.0.zip
instantclient-sdk-linux.x64-12.2.0.1.0.zip
instantclient-odbc-linux.x64-12.2.0.1.0-2.zip
To set up your 3scale system image with and Oracle Database, perform the steps outlined in the
following sections:
Prerequisites
68
CHAPTER 10. SETTING UP YOUR 3SCALE SYSTEM IMAGE WITH AN ORACLE DATABASE
Procedure
Example
DATABASE_URL="oracle-enhanced://user:password@my-oracle-
database.com:1521/threescalepdb"
Additional resources
For information on creating a new database in Oracle Database, see the Oracle documentation.
Prerequisites
You should have already carried out the steps in Preparing the Oracle Database .
Procedure
1. Clone the 3scale API Management OpenShift Templates GitHub repository. Use the following
command:
2. Place your Oracle Database Instant Client Package files into the 3scale-amp-openshift-
templates/amp/system-oracle/oracle-client-files directory.
4. Run the oc new-app command with the -f option and specify the build.yml OpenShift
template:
69
Red Hat 3scale API Management 2.8 Installing 3scale
$ oc new-app -f build.yml
5. Run the oc new-app command with the -f option to indicate the amp.yml OpenShift template,
and the -p option to specify the WILDCARD_DOMAIN parameter with the domain of your
OpenShift cluster:
6. Enter the following oc patch commands, replacing SYSTEM_PASSWORD with the Oracle
Database system password you set up in Preparing the Oracle Database :
7. Enter the following command, replacing DATABASE_URL to point to your Oracle Database,
specified in Preparing the Oracle Database :
8. Link the pull secret to the builder with the following command:
For more information about 3scale and Oracle Database support, see Red Hat 3scale API
Management Supported Configurations.
70