helm repo add kong https://charts.konghq.com
helm repo update
helm install kong/kong
kubectl describe ingress <ingress_name>
In the previous parts (part 1, part 2 and part 3), the setting up of GraphQL APIs and querying Neo4j were covered. In this article, you will be applying the Kong API gateway and making it the single point of entry into the AWS EKS cluster.
You need to have a running EKS cluster and created and applied a .kubeconfig file for your cluster.
If not already in place, refer to the official AWS link for creating a cluster and configuring EKS.
Kong is an open-source API gateway, built on top of Nginx. It helps to manage the control traffic, in terms of authentication, rate limiting, Caching, Monitoring, and so on. To start using Kong in AWS EKS, you first need to install the ingress controller in the cluster. To install the Kong ingress controller, you can use Helm charts, which requires the installation of Helm. After installation, you just need to execute the following commands:
After the controller is installed, you can implement all kinds of configurations. Here are some samples of routing and rate-limiting:
The above sample is a YAML file, which is used as an ingress resource to configure the ingress controller. In this sample, the traffic is rerouted from the KONG URL, which is exposed to different microservices based on the path URL. Check the configuration through the following command:
After ingress routing is configured, you can apply different Kong plugins. In this example, the rate limit plugin is applied to the microservices.
In the following sample, the access to any microservice is being limited; that is an API cannot be called more than two times in a second. You can also place a limit, based on the number of requests executed in a minute, hour, day, month, and year. A limit based on request per customer, IP, and microservice can be placed as well.
Kong will provide you with a URL that will be exposed to the world for incoming traffic. From there on, the controller will check ingress resource configurations and plugins to perform re-routing and rate limiting. The architecture diagram is as follows:
In this article, you have learnt about the installation and configuration of the Kong API gateway at a very high level. The blog series will provide you with a good start to develop GraphQL API using GraphDB and deploying an API gateway for the application.