am-pattern-2

by Helm

Helm chartv4.2.0-2App 4.2.0

A Helm chart for the deployment of WSO2 API Management deployment pattern 2

About this chart

Pattern 2: Helm Chart for Standard HA Deployment of WSO2 API Manager with Multitenancy along with WSO2 Micro Integrator

This deployment consists of two API-M nodes and two nodes each of the integration runtimes (Micro Integrator/Streaming Integrator) per tenant. You can use this pattern when traffic from different tenants in the API-M cluster needs to be handled in isolation. This deployment also allows you to direct the traffic of each tenant to a separate integration cluster.

For advanced details on the deployment pattern, please refer to the official documentation.

Contents

  • Prerequisites
  • Quick Start Guide
  • Configuration
  • Runtime Artifact Persistence and Sharing
  • Managing Java Keystores and Truststores
  • Configuring SSL in Service Exposure

Prerequisites

  • WSO2 product Docker images used for the Kubernetes deployment.

    WSO2 product Docker images available at DockerHub package General Availability (GA) versions of WSO2 products with no WSO2 Updates.

    For a production grade deployment of the desired WSO2 product-version, it is highly recommended to use the relevant Docker image which packages WSO2 Updates, available at WSO2 Private Docker Registry. In order to use these images, you need an active WSO2 Subscription.

  • Install Git, Helm and Kubernetes client in order to run the steps provided in the following quick start guide.

  • An already setup Kubernetes cluster.

  • Install NGINX Ingress Controller.

  • Add the WSO2 Helm chart repository.

     helm repo add wso2 https://helm.wso2.com && helm repo update
    

Quick Start Guide

1. Install the Helm Chart

You can install the relevant Helm chart either from WSO2 Helm Chart Repository or by source.

Note:

  • This Helm chart has been implemented by extending the advance/am-pattern-1 Helm resource.
  • NAMESPACE should be the Kubernetes Namespace in which the resources are deployed.

Install Chart From WSO2 Helm Chart Repository

Deploy the Kubernetes resources using the Helm Chart

  • Helm version 2

    helm install --name <RELEASE_NAME> wso2/am-pattern-2 --version 4.2.0-1 --namespace <NAMESPACE>
    
  • Helm version 3

    helm install <RELEASE_NAME> wso2/am-pattern-2 --version 4.2.0-1 --namespace <NAMESPACE> --create-namespace
    

The above steps will deploy the deployment pattern using WSO2 product Docker images available in WSO2 Private Docker Registry. Please provide your WSO2 Subscription credentials via input values (using --set argument).

Please see the following example.

  • To provide WSO2 Subscription credentials for WSO2 API Manager and WSO2 Micro Integrator as in pattern 1

    --set am-pattern-1.wso2.subscription.username=$SUBSCRIPTION_USERNAME --set am-pattern-1.wso2.subscription.password=$SUBSCRIPTION_PASSWORD
    
  • To provide WSO2 Subscription credentials for additional WSO2 Micro Integrator deployment for the new tenant

    --set wso2.subscription.username=$SUBSCRIPTION_USERNAME --set wso2.subscription.password=$SUBSCRIPTION_PASSWORD 
    

Below example is to provide WSO2 Subscription credentials for all WSO2 API Manager and WSO2 Micro Integrator tenant 1 and tenant 2 deployments

export SUBSCRIPTION_USERNAME=<SUBSCRIPTION_USERNAME>
export SUBSCRIPTION_PASSWORD=<SUBSCRIPTION_PASSWORD>

helm install --name <RELEASE_NAME> wso2/am-pattern-2 --version 4.2.0-1 --namespace <NAMESPACE> --set wso2.subscription.username=$SUBSCRIPTION_USERNAME --set wso2.subscription.password=$SUBSCRIPTION_PASSWORD --set am-pattern-1.wso2.subscription.username=$SUBSCRIPTION_USERNAME --set am-pattern-1.wso2.subscription.password=$SUBSCRIPTION_PASSWORD

If you are using a custom WSO2 Docker images you will need to provide those information via the input values. Please refer API Manager Server Configurations, Micro Integrator Server Configurations for Tenant 1 and Micro Integrator Server Configurations for Tenant 2

Install Chart From Source

In the context of this document,

  • KUBERNETES_HOME will refer to a local copy of the wso2/kubernetes-apim Git repository.
  • HELM_HOME will refer to <KUBERNETES_HOME>/advanced.

Clone the Helm Resources for WSO2 API Manager Git repository.

git clone https://github.com/wso2/kubernetes-apim.git

Deploy Helm chart for WSO2 API Manager Pattern 2 deployment.

Deploy the Kubernetes resources using the Helm Chart

  • Helm version 2

    helm install --dep-up --name <RELEASE_NAME> <HELM_HOME>/am-pattern-2 --version 4.2.0-1 --namespace <NAMESPACE>
    
  • Helm version 3

    helm install <RELEASE_NAME> <HELM_HOME>/am-pattern-2 --version 4.2.0-1 --namespace <NAMESPACE> --dependency-update --create-namespace
    

The above steps will deploy the deployment pattern using WSO2 product Docker images available in WSO2 Private Docker Registry. Please provide your WSO2 Subscription credentials via input values (using --set argument).

Please see the following example.

 helm install --name <RELEASE_NAME> <HELM_HOME>/am-pattern-2 --version 4.2.0-1 --namespace <NAMESPACE> --set wso2.subscription.username=<SUBSCRIPTION_USERNAME> --set wso2.subscription.password=<SUBSCRIPTION_PASSWORD>

If you are using a custom WSO2 Docker images you will need to provide those information via the input values. Please refer API Manager Server Configurations, Micro Integrator Server Configurations for Tenant 1 and Micro Integrator Server Configurations for Tenant 2

Or else, you can configure the default configurations inside the am-pattern-1 helm chart values.yaml file. Refer this for to learn more details about the values.yaml file.

Note: From the above Helm commands, base image of a Micro Integrator is deployed (without any integration solution). To deploy your integration solution with the Helm charts follow the below steps.

  1. Create an integration service using WSO2 Integration Studio and expose it as a Managed API. Then create a Docker image and push it to your private or public Docker registry. - INTEGRATION_IMAGE_REGISTRY will refer to the Docker registry that created Docker image has been pushed - INTEGRATION_IMAGE_NAME will refer to the name of the created Docker image - INTEGRATION_IMAGE_TAG will refer to the tag of the created Docker image
  2. If your Docker registry is a private registry, create an imagePullSecret. - IMAGE_PULL_SECRET will refer to the created image pull secret
  3. Deploy the helm resource using following command.
helm install <RELEASE_NAME> wso2/am-pattern-2 --version 4.2.0-1 --namespace <NAMESPACE> --set wso2.deployment.mi.dockerRegistry=<INTEGRATION_IMAGE_REGISTRY> --set wso2.deployment.mi.imageName=<INTEGRATION_IMAGE_NAME> --set wso2.deployment.mi.imageTag=<INTEGRATION_IMAGE_TAG> --set wso2.deployment.mi.imagePullSecrets=<IMAGE_PULL_SECRET>

Note: If you are using Rancher Desktop for the Kubernetes cluster, add the following changes.

  1. Change storageClass to local-path in values.yaml.

Choreo Analytics

If you need to enable Choreo Analytics with WSO2 API Manager, please follow the documentation on Register for Analytics to obtain the on-prem key for Analytics.

The following example shows how to enable Analytics with the helm charts.

Helm v2

helm install --name <RELEASE_NAME> wso2/am-pattern-2 --version 4.2.0-1 --namespace <NAMESPACE> --set wso2.choreoAnalytics.enabled=true --set wso2.choreoAnalytics.endpoint=<CHOREO_ANALYTICS_ENDPOINT> --set wso2.choreoAnalytics.onpremKey=<ONPREM_KEY>

Helm v3

helm install <RELEASE_NAME> wso2/am-pattern-2 --version 4.2.0-1 --namespace <NAMESPACE> --set wso2.choreoAnalytics.enabled=true --set wso2.choreoAnalytics.endpoint=<CHOREO_ANALYTICS_ENDPOINT> --set wso2.choreoAnalytics.onpremKey=<ONPREM_KEY> --create-namespace

You will be able to see the Analytics data when you log into Choreo Analytics Portal.

2. Obtain the external IP

Obtain the external IP (EXTERNAL-IP) of the API Manager Ingress resources, by listing down the Kubernetes Ingresses.

kubectl get ing -n <NAMESPACE>

The output under the relevant column stands for the following.

API Manager Publisher-DevPortal

  • NAME: Metadata name of the Kubernetes Ingress resource (defaults to wso2am-pattern-1-am-ingress)
  • HOSTS: Hostname of the WSO2 API Manager service (<wso2.deployment.am.ingress.management.hostname>)
  • ADDRESS: External IP (EXTERNAL-IP) exposing the API Manager service to outside of the Kubernetes environment
  • PORTS: Externally exposed service ports of the API Manager service

API Manager Gateway

  • NAME: Metadata name of the Kubernetes Ingress resource (defaults to wso2am-pattern-1-am-gateway-ingress)
  • HOSTS: Hostname of the WSO2 API Manager's Gateway service (<wso2.deployment.am.ingress.gateway.hostname>)
  • ADDRESS: External IP (EXTERNAL-IP) exposing the API Manager's Gateway service to outside of the Kubernetes environment
  • PORTS: Externally exposed service ports of the API Manager' Gateway service

API Manager Websub

  • NAME: Metadata name of the Kubernetes Ingress resource (defaults to wso2am-pattern-1-am-websub-ingress)
  • HOSTS: Hostname of the WSO2 API Manager's Websub service (<wso2.deployment.am.ingress.websub.hostname>)
  • ADDRESS: External IP (EXTERNAL-IP) exposing the API Manager's Websub service to outside of the Kubernetes environment
  • PORTS: Externally exposed service ports of the API Manager' Websub service

Micro Integrator Management APIs of Tenant 1

  • NAME: Metadata name of the Kubernetes Ingress resource (defaults to wso2am-pattern-1-mi-1-management-ingress)
  • HOSTS: Hostname of the WSO2 Micro Integrator service (<wso2.deployment.mi.ingress.management.hostname>)
  • ADDRESS: External IP (EXTERNAL-IP) exposing the Micro Integrator service to outside of the Kubernetes environment
  • PORTS: Externally exposed service ports of the Micro Integrator service

Micro Integrator Management APIs of Tenant 2

  • NAME: Metadata name of the Kubernetes Ingress resource (defaults to wso2am-pattern-2-mi-2-management-ingress)
  • HOSTS: Hostname of the WSO2 Micro Integrator service (<wso2.deployment.mi.ingress.management.hostname>)
  • ADDRESS: External IP (EXTERNAL-IP) exposing the Micro Integrator service to outside of the Kubernetes environment
  • PORTS: Externally exposed service ports of the Micro Integrator service

3. Add a DNS record mapping the hostnames and the external IP

If the defined hostnames (in the previous step) are backed by a DNS service, add a DNS record mapping the hostnames and the external IP (EXTERNAL-IP) in the relevant DNS service.

If the defined hostnames are not backed by a DNS service, for the purpose of evaluation you may add an entry mapping the hostnames and the external IP in the /etc/hosts file at the client-side.

<EXTERNAL-IP> <wso2.deployment.am.ingress.management.hostname> <wso2.deployment.am.ingress.gateway.hostname> <wso2.deployment.am.ingress.websub.hostname> <wso2.deployment.mi.ingress.management.hostname> <wso2.deployment.mi.ingress.management.hostname>

4. Access Management Consoles

  • API Manager Publisher: https://<wso2.deployment.am.ingress.management.hostname>/publisher

  • API Manager DevPortal: https://<wso2.deployment.am.ingress.management.hostname>/devportal

  • API Manager Carbon Console: https://<wso2.deployment.am.ingress.management.hostname>/carbon

Configuration

The following tables lists the configurable parameters of the chart and their default values.

WSO2 Subscription Configurations for WSO2 API Manager and Micro Integrator Tenant 1 Deployment

| Parameter | Description | Default Value | |----------------------------------------------------------------

Deploy am-pattern-2 with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has am-pattern-2 on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartam-pattern-2 is pinned at v4.2.0-2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply