You can easily deploy WSO2 API Microgateway on a Kubernetes cluster. Follow the step-by-step instructions below to quickly download, configure, and deploy the Microgateway on a Kubernetes cluster.
Before you begin...
- Install and set up the Kubernetes command-line tool, kubectl. For detailed instructions on installing kubectl, see https://kubernetes.io/docs/tasks/tools/install-kubectl/.
- Install Helm in your Kubernetes cluster using the
helm init
command. For detailed instructions on installing Helm, see https://helm.sh/docs/using_helm/#installing-helm.
- Download the Kubernetes Microgateway Helm chart ZIP file from here and extract it. Let's refer to the extracted Microgateway Helm chart directory location as
<K8S_MICROGATEWAY_HOME>
throughout this section. Edit the
<K8S_MICROGATEWAY_HOME>/values.yaml
file and specify appropriate values to configure the Kubernetes Microgateway Helm chart.values.yaml#Microgateway configurations #Define the number of gateways to be deployed replicaCount: 2 namespace: name-of-the-namespace # Define Docker credentials # Use cloud login email as the email # Use the value of Base64(cloud-email:cloud-password) as the auth value auths: https://docker.cloud.wso2.com: email: cloud-login-mail auth: Y2xvdWQtbG9naW4tZW1haWw6Y2xvdWQtcGFzc3dvcmQ= #Define the custom-URL of the microgateway service along with the certificate information ingress: host: microgateway.sample.com tls: tlsCertificate: certificate-of-the-hostname tlsKey: private-key-of-the-hostname ## Include the organization authentication information organizationDetails: tenantName: tenant-domain email: cloud-login-email password: cloud-password # Define the allocated resources per gateway resources: limits: cpu: 400m memory: 1024Mi requests: cpu: 400m memory: 1024Mi
Navigate to the
<K8S_MICROGATEWAY_HOME>
directory using the command line and execute the following command to deploy the Microgateway in your Kubernetes cluster:helm install --name micro-gateways-deployment .
This will set up the following deployment in your Kubernetes cluster:
Once you set up the deployment, you need to obtain the hostname of your Nginx load balancer and set it as the DNS of your Microgateway custom URL.Execute the following command to obtain the hostname of the Nginx load balancer:
kubectl get svc micro-gateways-deployment-private-jet-mode-nginx-controller -o yaml
This provides an output similar to the following, where you can find the hostname at the end:
... loadBalancer: ingress: - hostname: abc2adaa290d711e994d802f89b5426a-1544968781.us-west-2.elb.amazonaws.com
Use the hostname as the DNS record of your custom URL domain.
Now that you have set up the DNS of your Microgateway custom URL, you can follow the steps here to test your Microgateway deployment.
Once you test the deployment, you can access the Microgateway via the Microgateway URL.