Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Manage your APIs and Microservices with an API Gateway

348 views

Published on

Introduction to API Gateways and Kong during the OpenAPI (Swagger) meetup hosted by Kong (2017/03/30).

Published in: Software

Manage your APIs and Microservices with an API Gateway

  1. 1. Thibault Charbonnier Kong Lead Engineer @ Mashape 1 Manage your APIs and Microservices with an API Gateway 03/30/2017 - Swagger & Kong meetup @ Mashape HQ
  2. 2. 2 Summary 1. Why an API Gateway? 2. Kong 3. Demo 4. Kong 0.10 03/30/2017 - Swagger & Kong meetup @ Mashape HQ
  3. 3. Why an API Gateway? 3
  4. 4. Why an API Gateway? Building vs Running an API 4
  5. 5. Why an API Gateway? It’s a reverse proxy, sitting between your clients and your upstream services 5
  6. 6. Why an API Gateway? 6 Monolithic vs Microservices
  7. 7. 7 https://github.com/Mashape/kong https://getkong.org/plugins/
  8. 8. Kong Overview 8
  9. 9. 9 Kong Overview - Stack NGINX lua-nginx-module Kong C Lua (but really, LuaJIT) OpenResty(Lua libraries) Kong PluginsCommunity Plugins ngx_http_proxy_module
  10. 10. Kong Overview - Datacenter architecture 10 PostgreSQL K Microservice A K K Microservice B Microservice C Internal API LBClient
  11. 11. Kong Overview - Multi-datacenter architecture 11 us-west-1 us-east-1 Cassandra Cassandra K K K K K K Microservice A Microservice B Microservice C Microservice A Microservice B Microservice C LB LB
  12. 12. Demo 12
  13. 13. 13 $ kong version 0.10.1 $ kong start Demo 1. Start Kong 2. Add an API 3. Apply a plugin on it 4. Make an API call
  14. 14. 14 $ curl -i -X POST http://localhost:8001/apis/ -d "name=example" -d "upstream_url=http://httpbin.org" -d "hosts=example.org" Demo Step 1: add an API Here, we are calling the Admin API Server (port 8001)
  15. 15. 15 $ curl -i -X POST http://localhost:8001/apis/example/plugins/ -d "name=request-transformer" -d "config.add.headers=x-new-header:foo" Demo Step 2: apply a plugin Here, we are calling the Admin API Server (port 8001)
  16. 16. 16 $ curl -i http://localhost:8000/get -H "Host: example.org" Demo Step 3: make an API call Notice how this request is going through the Proxy Server (port 8000)
  17. 17. Kong 0.10 - Dynamic load balancing - Coupled with DNS resolution (A & SRV records) - Flexible routing - AWS Lambda plugin - Performance improvements https://github.com/Mashape/kong/releases/tag/0.10.0 17
  18. 18. Demo - 0.10 18
  19. 19. 19 $ curl -i -X POST http://localhost:8001/upstreams/ -d "name=httpbin.org" Demo 0.10 Step 1: add an Upstream Object
  20. 20. 20 $ curl -i -X POST --url http://localhost:8001/upstreams/httpbin.org/targets -d "target=<ip>:<port>" -d "weight=100" Demo 0.10 Step 2: add Targets to the Upstream
  21. 21. 21 $ curl -i http://localhost:8000/get -H "Host: example.org" Demo 0.10 Step 3: make an API call with load balancing
  22. 22. Thank you! 22 Questions? https://getkong.org https://www.mashape.com https://github.com/Mashape/kong 03/30/2017 - Swagger & Kong meetup @ Mashape HQ

×