API Manager

Deploy WSO2 API Manager on OpenShift, publish an API backed by Micro Integrator, and issue calls with Identity Server tokens.

Updated CompTech Team

WSO2 API Manager is the API product layer. It stores the OpenAPI description, publishes a gateway endpoint, applies subscription and rate-limit policies, and shows applications in a developer portal. The integration behind the API is usually Micro Integrator. The tokens are usually Identity Server 7, registered as a third-party key manager.

This lab uses the all-in-one pattern: one deployment that runs the control plane and the gateway, which is the right size for a lab and for a modest site. Split the control plane, the universal gateway and the traffic manager only when you have a reason in throughput or in blast radius. API Manager 4.5 is the worked Helm release (wso2/wso2am-all-in-one chart 4.5.0-3). API Manager 4.7 is the later GA line and installs the same way with chart 4.7.0-1 and image wso2/wso2am:4.7.0. Pick one line and match the chart, the image and the documentation. Do not mix a 4.7 image with a 4.5 values file.

Prerequisites

  • OpenShift, oc, helm, and apictl at a version that matches the API Manager line.
  • Micro Integrator already serving the /health API, if you want a real backend. You can also point the sample at any in-cluster HTTP service.
  • A pull secret if the image comes from a private WSO2 registry. The public image is suitable for a lab; a subscription registry is what you mirror for production.

Values that OpenShift will accept

OpenShift assigns the container UID. The chart must leave it alone, and the script ConfigMap must be executable by that UID.

kubernetes:
  openshift:
    enabled: true
  securityContext:
    runAsUser: null
    seLinux:
      enabled: false
    seccompProfile:
      type: RuntimeDefault
  enableAppArmor: false
  configMaps:
    scripts:
      defaultMode: "0457"

Save that as openshift-values.yaml. Add the hostname and a generated encryption key through Helm --set, not by committing the key.

Install

helm repo add wso2 https://helm.wso2.com && helm repo update
oc create namespace wso2
helm install apim wso2/wso2am-all-in-one \
  --namespace wso2 \
  --version 4.5.0-3 \
  -f openshift-values.yaml
oc get pods -n wso2 -w

Create Routes for the publisher, the developer portal and the gateway host. The gateway host is the one clients call. The publisher is the one designers use. Keep them on separate hostnames so a network policy can allow designers to one and applications to the other.

Change the default administrator password. If the pod restarts forever with a permission denied on a script, the defaultMode did not apply. Fix the values and upgrade the release. Granting anyuid hides the mistake.

Publish the MI API

In Publisher, create an API whose production endpoint is the Micro Integrator Service:

http://wso2-mi.wso2-integration.svc:8290/health

Or import it with apictl, which is the path you can review:

apictl add env lab --apim https://apim.apps.lab.example.com
apictl login lab -u admin -k
apictl import api -f HelloAPI -e lab --preserve-provider

HelloAPI is a directory apictl init produced, with the OpenAPI file and the endpoint above. Deploy the API to the gateway and set a subscription policy. An API with no policy is an accident.

Tokens

For the lab's own resident key manager, create an application in the developer portal, subscribe it to the API, and generate a key. For Identity Server 7, add a key manager in the admin console:

Field Value
Name WSO2IS7
Type WSO2 Identity Server 7
Well-known URL https://<is-host>/oauth2/token/.well-known/openid-configuration
Issuer https://<is-host>/oauth2/token
Client registration https://<is-host>/api/identity/oauth2/dcr/v1.1/register
Introspection https://<is-host>/oauth2/introspect
Token https://<is-host>/oauth2/token

Identity Server 7 in this role does not provide API Manager tenancy, and it is not the resident key manager. Applications that need those features stay on the resident key manager. Everyone else can use the issuer you just registered, which is also the issuer Connectivity Link can check at the edge.

TOKEN=$(curl -sk -u "$CLIENT_ID:$CLIENT_SECRET" \
  -d "grant_type=client_credentials" \
  "https://<is-host>/oauth2/token" | jq -r .access_token)
curl -sk -H "Authorization: Bearer $TOKEN" \
  "https://gw.apps.lab.example.com/health"

A 200 with the MI payload means all three products agree. A 401 is a token or issuer mismatch: compare iss in the token with the issuer API Manager has stored. A 429 is the subscription policy, which you can confirm in the API's runtime configuration.

Operate it

Back up the API Manager database with the release. APIs can be reimported from Git if you really do keep them in apictl projects; subscriptions and analytics cannot. Send gateway access logs to the cluster log store. Rate-limit policies belong in the API definition, reviewed beside the OpenAPI file, so a lab API does not ship with an infinite quota.

On a sealed network, mirror the image and the chart, and run the same manual-approval habit the operator list uses for operators. Helm will not stop you pulling a new chart. You have to.

What's next

  1. Micro Integrator: build the backend this API publishes.
  2. Identity Server: run the issuer behind the key manager.
  3. Connectivity Link: enforce the same token and a gateway rate limit on the cluster ingress.