How to install & setup Gateway

See also

  1. How to install kubeadm (K8s cluster)
  2. How to install k6

Express Gateway

Install on bare metal or VM
How to setup gateway

On docker

    
docker run -d --name express-gateway \
    -v "$(pwd)/config":/var/lib/eg \
    -p 8080:8080 \
    -p 9876:9876 \
    -p 9443:9443 \
    express-gateway
    
  

On K8s

YAML file
  1. Crate ConfigMap
  2.       
    kubectl create configmap express --from-file=config/
          
        
  3. Create Deployment
  4.       
    kubectl apply -f deploy-express.yaml
          
        
  5. Create LoadBalancer
  6.       
    kubectl apply -f service-express.yaml
          
        

Kong Gateway

Install on bare metal or VM
How to setup Gateway with database(ex. postgres)
How to setup Gateway without database

On docker

  1. create docker network
  2.       
    docker network create kong-net
          
        
  3. create database
  4.       
    docker run -d --name kong-database \
        --network=kong-net \
        -p 5432:5432 \
        -e "POSTGRES_USER=kong" \
        -e "POSTGRES_DB=kong" \
        -e "POSTGRES_PASSWORD=kong" \
        -v $(pwd)/kong_data:/var/lib/postgresql/data \
        postgres:9.6
          
        
  5. Initial database
  6.       
    docker run --rm \
        --network=kong-net \
        -e "KONG_DATABASE=postgres" \
        -e "KONG_PG_HOST=kong-database" \
        -e "KONG_PG_USER=kong" \
        -e "KONG_PG_PASSWORD=kong" \
        -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
        kong:latest kong migrations bootstrap
          
        
  7. Create Kong
  8.       
    docker run -d --name kong \
        --network=kong-net \
        -e "KONG_DATABASE=postgres" \
        -e "KONG_PG_HOST=kong-database" \
        -e "KONG_PG_USER=kong" \
        -e "KONG_PG_PASSWORD=kong" \
        -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
        -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
        -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
        -e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
        -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
        -e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
        -p 8000:8000 \
        -p 8443:8443 \
        -p 127.0.0.1:8001:8001 \
        -p 127.0.0.1:8444:8444 \
        kong:latest
          
        
  9. Create Konga (WebUI)
  10. Your IP address where your browser can access

    Find your IP address where your browser can access.

    Then replace flowing 163.22.22.60 with your IP address.

          
    docker run --rm pantsel/konga:latest \
        -c prepare \
        -a postgres \
        -u postgresql://kong:kong@163.22.22.60:5432/konga
    
    docker run -d -p 1337:1337 \
        --network kong-net \
        --name konga \
        -e "NODE_ENV=production" \
        -e "DB_ADAPTER=postgres" \
        -e "DB_URI=postgresql://kong:kong@163.22.22.60:5432/konga" \
        pantsel/konga
          
        

On K8s

YAML file
  1. Create ConfigMap
  2.       
    kubectl create configmap kong --from-file=kong.yml
          
        
  3. Create Deployment
  4.       
    kubectl apply -f deploy-kong.yaml
          
        
  5. Create LoadBalancer
  6.       
    kubectl apply -f service-kong.yaml