GithubHelp home page GithubHelp logo

terraform-kubernetes-kong-gateway's Introduction

terraform-kubernetes-kong-enterprise

A terraform module for provisioning Kong GW into kuberenetes.

Status

Prototyping - frequent commits, only a few tests

Prerequisits

Using the module

This module utilises the terraform kubernetes provider, so when including this module in your code you will need to specify the provider and args e.g.

provider "kubernetes" {
  config_path = "~/.kube/config"
}

You will also need to provide secrets to the kubernetes cluster for your kong license and your docker registry. You can look at the hybrid example in the examples directory to see how this can be done.

Usage

locals {

  kong_image_pull_secrets = [
    {
      name = "name_of_docker_registry_secret_in_k8"
    }
  ]

  kong_volume_mounts = [
    {
      mount_path = "/etc/secrets/kong-cluster-cert"
      name       = "name_of_tls_secrets_in_k8"
      read_only  = true
    }
  ]

  kong_volume_secrets = [
    {
      name        = "name_of_tls_secrets_in_k8"
      secret_name = "name_of_tls_secrets_in_k8"
    }
  ]

  kong_cp_secret_config = [
    {
      name        = "KONG_LICENSE_DATA"
      secret_name = "name_of_generic_secret_in_k8"
      key         = "name_of_generic_secret_in_k8"
    }
  ]

  kong_cp_config = [
    {
      name  = "KONG_ADMIN_LISTEN"
      value = "0.0.0.0:8001, 0.0.0.0:8444 ssl"
    },
    {
      name  = "KONG_ADMIN_GUI_AUTH"
      value = "basic-auth"
    },
    {
      name  = "KONG_ADMIN_GUI_LISTEN"
      value = "0.0.0.0:8002, 0.0.0.0:8445 ssl"
    },
    ...
    ...
    ...
    <truncated>
  ]
}

module "kong-enterprise-control-plane" {
  source              = "[email protected]:Kong/terraform-kubernetes-kong-enterprise.git"
  deployment_name     = "kong-control-plane"
  namespace           = "kong-cp"
  deployment_replicas = 2
  config              = local.kong_cp_config
  secret_config       = local.kong_cp_secret_config
  kong_image          = "kong-docker-kong-enterprise-edition-docker.bintray.io/kong-enterprise-edition:2.2.0.0-alpine"
  image_pull_secrets  = local.kong_image_pull_secrets
  volume_mounts       = local.kong_volume_mounts
  volume_secrets      = local.kong_volume_secrets
}

Examples of how to use the module are in the examples directory. Currently two examples exist hybrid and hybrid_with_ingress.

hybrid deploys Kong in hybrid mode and exposes the Kong services via Kubernetes services of type load balancer.

hybrid_with_ingress deploys in hybrid mode but uses kubernetes clusterIP services and exposes those behing a kubernetes ingress service. This example is still a work in progress

Testing

This module uses kitchen-terraform to test its self. To install you can use the Gemfile. You will need Ruby (ruby devel needed as well) installed and bundler, then you can run bundle install in the repos home directory

Hybrid Example

Prerequisites

  • A kubernetes environment to use with kube config file at ~/.kube/config
  • A docker config.json located at ~/.docker/config.json this file should contain the auth details for your docker registry (e.g. bintray). You can generate this file by running docker login
docker login -u <my-user> -p <my-pass> kong-docker-kong-enterprise-edition-docker.bintray.io
  • A Kong license string in a file at the following location ~/.kong_license

The docker config file and the license file are read in as secrets to kubernetes by the secret_setup.tf terraform

Run

terraform init
terraform apply

Destroy

terraform destroy

terraform-kubernetes-kong-gateway's People

Contributors

srb3 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.