Deploy Kong Api Management using Azure Resource Manager

 

I’m currently searching for a Api Management Solution & I’ve found Kong. Kong is built on top of reliable technologies like NGINX and Apache Cassandra, and provides you with an easy to use RESTful API to operate and configure the system. It was developed by The Mashape Team and used internally. Then they decided to propose this solution on GitHub as an Open-Source Api Management.

Kong is scalable, modular (with plugin development) and can run on any infrastructure.

At this time the Azure Deployment was not provided so I decided to create a Azure Resource Template to deploy an Test Environment of Kong with one Linux Ubuntu Server and a local installation of Kong & Cassandra on this server. (A standard A2 virtual Machine, 2 core, 3,5 Go RAM)

The Azure Resource Manager provide a way to deploy, manage and monitor Azure Resource in a Logical Resource Group. You can use template to deploy a large number of assets using the ARM. (more info on the Microsoft Azure Web Site)

Ready !

Starting the Environment

be sure you’ve an azure subscription before continue, you can try for free. And the Windows Azure Powershell  with Azure Resource Manager Commandlets.

Then clone the following Git Hub Repository :

$ git clone https://github.com/jdevillard/kong-azure

In this repository, you will have :

  • azuredeploy.json : the azure template file
  • azuredeploy.parameters.json : the azure template parameter file in which we’ll put value regarding our environment
  • kongscript.sh : this script will install the necessary software arount kong (JAVA, Cassandra etc…)
  • deploy.ps1 : powershell script to deploy the azure template.

With all of this, you need to customize :

  • azuredeploy.parameters.json with :
    • an Azure Storage Account
    • a Admin User Name (used to ssh to the Linux)
    • an SSH Key : you can follow this tutorial if necessary
    • dns Name for the public Ip to reach the Kong Gateway
    • the os of ubuntu (don’t change for latest version supported in azure)
    • the location of the Virtual Machine
    • the name of the Network Security Group (don’t change if you don’t know what it is)

 

  • deploy.ps1  with :
    • $resourceGroupName : the name of the new resource group where you want to create the Kong Virtual Machine
    • $subscriptionId : the id of your Azure Subscription to deploy the resource group.

 

Then you can place your prompt in the script directory and execute the deploy.ps1 script.

The script will ask you your Microsoft Account that allow you to access to your Azure Subscription.

After few minutes, you will have all you assets deployed in a single virtual machine on Microsoft Azure.

image

 

This template deploy :

  • a new Storage Account
  • an Azure Virtual Network
  • a Network Security Group in this network
  • a virtual machine
  • a network interface to allow communication between the virtual machine inside the network and internet
  • a public IP with an DNS
  • The port 8000 (for proxy) and 8001 (for admin) are opened in the VNET (and also the 22 for the SSH).

    Once it is deploy, you can test using Fiddler or Curl with the following url :

    curl GET http://<DNS>.<Location>.cloudpapp.azure.com:8001

    for me (with default value) :

    curl GET http://kongtemplate1.westeurope.cloudapp.azure.com:8001

    you will have the default response with the plugin available on the Gateway :

     

    This Virtual Machine is good to test the Kong Gateway on a single instance.

    I will see in the futur if I can deploy a cluster of Kong with Cassandra cluster for the configuration repository.

    Hope This Help!

    This entry was posted in Azure, English, Microsoft and tagged , , . Bookmark the permalink.

    One Response to Deploy Kong Api Management using Azure Resource Manager

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s