Autoscaling WSO2 API Gateway and WSO2 Choreo Connect on Kubernetes — Part 2

Gayan Liyanagamage
3 min readJun 10, 2022

Deploying Choreo Connect as a separate gateway environment and integrating with the same Control Plane

This is a three-part article series on how to deploy WSO2 API manager and Choreo Connect in the same Kubernetes environment and connect up with a single control plane. Please start following the article series from Part 1.

Part 1: https://gayanlggd.medium.com/autoscaling-wso2-api-gateway-and-wso2-choreo-connect-on-kubernetes-part-1-d78e12fdab83

WSO2 Choreo Connect is a cloud-native API gateway that is developer-centric. It provides support for deployment on top of any container orchestration tool such as Kubernetes. It provides modern API QoS aspects such as security, rate limiting, observability, and message mediation.

It is possible to connect multiple gateway environments to a single Control Plane with API Manager 4.0.0. We can use Choreo Connect Kubernetes artifacts to deploy the same. We will deploy Choreo Connect 1.0.0 in this instance.

  1. Download and extract Choreo Connect 1.0.0 distribution from the following URL.

https://wso2.com/choreo-connect/previous-releases/

2. Navigate to <CC_HOME>/k8s-artifacts/choreo-connect-with-apim/choreo-connect directory.

3. Make the following changes in the yaml files.

choreo-connect-deployment.yaml

  • Change ENFORCER_LABEL value to cc1
  • Change ROUTER_LABEL value to cc1

The left side is the changed version.

ROUTER_LABEL value updated
ENFORCE_LABEL value updated

choreo-connect-with-apim-ingress.yaml

  • Change ingress hosts to gw.cc.wso2.com and am.cc.wso2.com.
  • Change rules of am.cc.wso2.com to connect to the existing control plane by providing the backend service name as wso2am-pattern-3-am-cp-service

The left side is the changed version.

config-toml-configmap-for-eventhub.yaml

Change the values as below under the enforcer configurations.

[enforcer.throttling]
enableGlobalEventPublishing = true
jmsConnectionProviderURL = "amqp://admin:admin@carbon/carbon?failover='roundrobin?cyclecount='2''&brokerlist='tcp://wso2am-pattern-3-am-cp-1-service:5672;tcp://wso2am-pattern-3-am-cp-2-service:5672'"
[enforcer.throttling.publisher]
username = "admin"
password = "$env{tm_admin_pwd}"
[[enforcer.throttling.publisher.URLGroup]]
receiverURLs = ["tcp://wso2am-pattern-3-am-cp-1-service:9611","tcp://wso2am-pattern-3-am-cp-2-service:9611"]
authURLs = ["ssl://wso2am-pattern-3-am-cp-1-service:9711","ssl://wso2am-pattern-3-am-cp-2-service:9711"]

Change the values as below under the control plane configurations.

[controlPlane]
enabled = true
serviceURL = “https://wso2am-pattern-3-am-cp-service:9443/"
username = “admin”
password = “$env{cp_admin_pwd}”
environmentLabels = [“cc1”]
skipSSLVerification = true
[controlPlane.brokerConnectionParameters]
eventListeningEndpoints = [“amqp://admin:$env{cp_admin_pwd}@wso2am-pattern-3-am-cp-1-service:5672?retries=’10'&connectdelay=’30'”,”amqp://admin:$env{cp_admin_pwd}@wso2am-pattern-3-am-cp-2-service:5672?retries=’10'&connectdelay=’30'”]

4. Deploy the Kubernetes artifacts by running the below command in the same wso2 namespace.

kubectl create -f <CC_HOME>/k8s-artifacts/choreo-connect-with-apim/choreo-connect -n wso2

5. List the ingresses deployed in the namespaces used above.

kubectl get ing -n wso2

The new ingresses must be listed now.

Choreo Connect ingresses created

6. Add the new CC gateway hostname to the host file.

113.109.225.55 gw.cc.wso2.com

7. Add a new gateway environment via the admin application in the control plane.

Adding a new gateway environment

Now you should be able to selectively deploy APIs to each gateway environment and test the APIs through each gateway server separately.

8. Update the JWKS endpoint of the Resident KM and point it to the CP K8S service via the admin portal (https://am.wso2.com/admin).

Updating the JWKS endpoint

This marks the end of Part 2. Check out Part 3 from the below link to learn how to deploy Choreo Connect and integrate with the same Control Plane.

https://gayanlggd.medium.com/autoscaling-wso2-api-gateway-and-wso2-choreo-connect-on-kubernetes-part-3-8350d21566bd

--

--