jittagornp.me
จิตกร พิทักษ์เมธากุล
Jan 17, 2020

Setup Kong Loadbalancing

headers for all requests

Content-Type : application/json  

1. Add Upstreams server

1.1 set upstream name
http post

http://<GATEWAY_IP>:8001/upstreams

body

{
  "name" : "oauth.v1.service"    
}

1.2 set target servers under upstream http post

http://<GATEWAY_IP>:8001/upstreams/oauth.v1.service/targets

body

target server 1

{
  "target" : "10.130.50.115:30001",
  "weight" : 50
}

target server 2

{
  "target" : "10.130.12.164:30001",
  "weight" : 50
}

2. Add Service

http post

http://<GATEWAY_IP>:8001/services

body

{
  "name" : "oauth-service",
  "host" : "oauth.v1.service",
  "path" : "/"
}

3. Add Route under service

http post

http://<GATEWAY_IP>:8001/services/oauth-service/routes

body

{
  "hosts" : ["auth.mydomainname.com"],
  "paths" : ["/oauth/v1"]
}

4. Test Access

https://auth.mydomainname.com/oauth/v1

Reference

https://docs.konghq.com/1.4.x/loadbalancing/

Table of Contents

จิตกร พิทักษ์เมธากุล
วิธีการทำนายอนาคตที่ดีที่สุด คือ การสร้างมันขึ้นมา