Kong can easily be provisioned to Kubernetes cluster using the following steps:
-
Initial setup
Download or clone the following repo:
$ git clone [email protected]:Mashape/kong-dist-kubernetes.git $ cd kong-dist-kubernetes
If you want to run Kubernetes locally, please follow the README in
minikube
subfolder.Skip to step 3 if you have already provisioned a cluster and registered it with Kubernetes.
-
Deploy a GKE cluster
You need gcloud and [kubectl]https://cloud.google.com/container-engine/docs/quickstart#install_the_gcloud_command-line_interface) command-line tools installed and set upto run deployment commands. Also make sure your Google Cloud account has atleast two
STATIC_ADDRESSES
available.Using the
cluster.yaml
file from this repo, deploy a GKE cluster. Provide the following information before deploying:- Desired cluster name
- Zone in which to run the cluster
- A basicauth username and password for authenticating the access to the cluster
$ gcloud deployment-manager deployments \ create cluster --config cluster.yaml
By now, you have provisioned a Kubernetes managed cluster.
-
Deploy a Kong supported database
Before deploying Kong, you need to provision a Cassandra or PostgreSQL pod.
For Cassandra, use the
cassandra.yaml
file from this repo to deploy a CassandraService
and aReplicationController
in the cluster:$ kubectl create -f cassandra.yaml
For PostgreSQL, use the
postgres.yaml
file from the kong-dist-kubernetes repo to deploy a PostgreSQLService
and aReplicationController
in the cluster:$ kubectl create -f postgres.yaml
-
Deploy Kong
Using the
kong_<postgres|cassandra>.yaml
file from this repo, deploy a KongService
and aDeployment
to the cluster created in the last step:$ kubectl create -f kong_<postgres|cassandra>.yaml
-
Verify your deployments
You can now see the resources that have been deployed using
kubectl
:$ kubectl get rc $ kubectl get deployment $ kubectl get pods $ kubectl get services $ kubectl get logs <pod-name>
Once the
EXTERNAL_IP
is available for Kong Proxy and Admin services, you can test Kong by making the following requests:$ curl <admin-ip-address>:8001 $ curl <proxy-ip-address>:8000
-
Using Kong
Quickly learn how to use Kong with the 5-minute Quickstart.
When deploying into a Kubernetes cluster with Deployment Manager, it is
important to be aware that deleting ReplicationController
Kubernetes objects
does not delete its underlying pods, and it is your responisibility to
manage the destruction of these resources when deleting or updating a
ReplicationController
in your configuration.
Support, Demo, Training, API Certifications and Consulting available at http://getkong.org/enterprise.