Gravitee.io APIM on Kubernetes

Gravitee.io is an open-source, flexible, lightweight and super-fast API Management solution that helps to control who, when and how consumers access your APIs.

Version 1.22.0 was recently released with many great improvements and bug fixes. As usual, you can pick your preferred flavor to install or upgrade Gravitee APIM anywhere — bare metal with each piece installed one-by-one, on Docker container with each component in their own container and/or manage all the installation/upgrade with your chosen container orchestrator.

In this latest version, if deploying on containers and using Kubernetes to orchestrate your containers, you now can also use Helm Chart to package and deploy Gravitee on Kubernetes.

** For this post we will assume you have Kubernetes Cluster up and running, and MongoDB and Elasticsearch.

The Chart will deploy all major Gravitee APIM components, namely Gateway(s), API Management and Management UI.

If you want to have “full control” and see what is under the hood for this chart, you may clone the repository:

$ git clone https://github.com/gravitee-io/gravitee-kubernetes.git

After that, navigate to the directory where you cloned the repository and package it in a chart archive with:

$ helm package ./gravitee

If you want to, you could validate the package with:

$ helm install --dry-run --debug ./gravitee

To install the chart in your Kubernetes Cluster, run:

$ helm install gravitee-1.22.0.tgz

…or install with a release name of your choice, specify a file with your customized variable values (or use the default one) and your packaged chart file:

$ helm install --name gravitee-apim-example -f gravitee/values.yaml gravitee-*.tgz
Gravitee APIM Kubernetes Helm chart deployment in progress

After a few seconds, you should get Gravitee’s APIM main components pods running in your cluster:

All main Gravitee APIM components running as specified in the chart values

It is completely possible to control your Gravitee APIM deployment/releases through Helm. Track your deployments with:

$ helm history gravitee-apim-example
Helm Chart release control

I will not get into the details of all pieces that gets deployed, but I can tell it will save you a lot of time deploying, setting variable values, creating services to expose your containers in your cluster and many other aspects of your Gravitee APIM deployment.

Deployment details on Kubernetes dashboard

Since we use the Ingress controller to map to internal services associated with the containers, you can reach the Gravitee APIM components by mapping the host address (in our case apim.example.com) resolving to the cluster’s LB (Load Balancer) public IP address. 
If you have a DNS record, just update it to resolve to the cluster’s LB public IP.
If you do not have a DNS record and want to test locally, open your hosts file and add a new entry, mapping your cluster’s public IP address to your hostname.

In our example, we are using NGINX Ingress Controller and our LB public IP address is 104.197.19.1

To test from another machine, outside of the cluster (in this case a Linux-based OS), you can do:

$ echo '104.197.19.1 apim.example.com' | sudo tee -a /etc/hosts

A new entry will be added to hosts file:

New host entry added to /etc/hosts

If you are on Windows, you can type in the Run command…

notepad c:\windows\system32\drivers\etc\hosts

…and append a new entry:

104.197.19.1 apim.example.com
Run command and edit hosts file on Windows

With the host entry in place, you can head to your browser and navigate to the Gravitee APIM Portal UI at https://apim.example.com:

So, for this example, our endpoints would be:

# Portal UI
https://apim.example.com
# Management API
https://apim.example.com/management/
# Gateway
https://apim.example.com/gateway/

In this post, we could see how much time you can save deploying Gravitee APIM (or updating/upgrading) and the level of confidence and reproducibility you get when using the Gravitee Kubernetes Helm Chart.

If something doesn’t look right with your deployment, it is always possible to roll it back to a specific revision with:

$ helm rollback gravitee-apim-example 1

We hope you don’t have to, but if you need to delete your deployment and remove Gravitee APIM from your Kubernetes cluster, use:

$ helm delete gravitee-apim-example && helm del --purge gravitee-apim-example

Our hope is to further improve and streamline Gravitee APIM deployment allowing you to quickly deploy and access your API Management platform and start publishing, consuming and gaining insights about your APIs.

Next post we will show how to automate a full deployment on Kubernetes with MongoDB, Elasticsearch and Gravitee APIM.
See you then!