// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf


PER ANHALTER ZU


CLOUD-NATIVEN


API GATEWAYS
Mario-Leander Reimer


Principal Software Architect


@LeanderReimer


#cloudnativenerd #qaware


https://lreimer.github.io
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
3
https://imgur.com/gallery/LGAZEqu
The Earl
y

Code Monkey
The Monolith
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
4
Monolithic


Vintage System
Users
system.example.com
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
5
autonomous bounded contexts
loosely coupled stateless
makeameme.org
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
6
Users
Monolithic


Vintage System
A Shared PaaS
A Namespace
Service A
system.example.com
service-a.default.example.com
Route
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
7
Users
Monolithic


Vintage System
A Shared PaaS
A Namespace
Service A
system.example.com
service-a.default.example.com
Route
Service B
Route
service-b…
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
8
Users
Monolithic


Vintage System
A Shared PaaS
A Namespace
Service A
system.example.com
service-a.default.example.com
Route
Service B
Route
service-b…
Service C
Route
service-c…
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
9
Users
Monolithic


Vintage System
A Shared PaaS
A Namespace
Service A’
system.example.com
service-a.default.example.com
Route
Service B
Route
service-b…
Service C'
Route
service-c…
3rd Party Apps
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
10
Users
Monolithic


Vintage System
A Shared PaaS
A Namespace
Service A’
system.example.com
service-a.default.example.com
Route
Service B
Route
service-b…
Service C'
Route
service-c…
3rd Party Apps
B Namespace
Service X
Service Y
Service Z’
Unreliable


Legacy
Systems
SOAP
gRPC
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
11
Users
Monolithic


Vintage System
A Shared PaaS
A Namespace
Service A’
system.example.com
service-a.default.example.com
Route
Service B
Route
service-b…
Service C'
Route
service-c…
3rd Party Apps
B Namespace
Service X
Service Y
Service Z’
Unreliable


Legacy
Systems
SOAP
gRPC
Route
Internal
Systems
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
12
https://thenewstack.io/history-service-mesh/
APIs sind das Herzstück
erfolgreicher, digitaler Produkte.


Das richtige Management der APIs
von Beginn an ist essentiell, um den


Big Ball of Mud zu vermeiden.
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
13
APIs sind das Herzstück
erfolgreicher, digitaler Produkte.


Das richtige Management der APIs
von Beginn an ist essentiell, um den


Big Ball of Mud zu vermeiden.
https://thenewstack.io/history-service-mesh/
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
14
Users
Monolithic


Vintage System
A Shared PaaS
A Namespace
Service A
Service B
Service C
3rd Party Apps
B Namespace
Service X
Service Y
Service Z
Unreliable


Legacy
Systems
SOAP
API


Gateway
Backend
for
Frontend
Internal
Systems
API
Gateway
API
Proxy
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
15
API Gateways


sind wie das Façade Pattern für


Cloud Native Application Design


und Microservice Architekturen
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
• Tra
ffi
c Management: Path, Header, Host based Routing, Path Rewrite


• Rollout and Deployment: A/B Deployment, Canary Release, et.al.


• QoS and Resiliency: Circuit Breaker, Retry, Timeouts, Rate Limiting


• Security: AAA, Terminate TLS, Support for JWT and JWKS, Open ID, …


• Protocol Translation: XML to JSON, gRPC to JSON, …


• Transformation: Fan Out / Collect, B4F, Versioning, GraphQL, …


• Observability: Logging Integration, Monitoring, Distributed Tracing
16
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
17
W E
N
S
Ingress
Egress
API Gateways für


Nord-Süd Kommunikation
Service Meshes für


Ost-West Kommunikation
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
API Gateways in a Nutshell
• Vorteile


• Abstraktion der internen
Anwendungsstruktur


• Vereinfachter Client Code


• Einfaches Rollout und
Deployment, Versionierung, …


• B4Fs reduzieren die Anzahl
benötigter Client-Server Calls
18
• Nachteile


• Weiterer hoch-verfügbarer
Infrastruktur-Baustein der
betrieben werden muss


• Wird schnell zum DevOps
Flaschenhals im Fall von
zentralem Betrieb


• Business Logik im API Gateway
führt versehentlich zu einem ESB
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
Mögliche Kriterien für einen Vergleich
• Maturity: Gute und aktive Community, keine Issues, häu
fi
ge Releases


• License: Open Source oder Commercial


• Supported Features: Tra
ffi
c Management, Deployment, Security, Translation,
Transformation, QoS, Resiliency


• DevOps Friendly: Einfaches Setup und Betreibbarkeit, Plattform, CI/CD und
GitOps Support, Documentation


• Performance: Kleiner Overhead, hoher Durchsatz, Skalierbarkeit, Verfügbarkeit


• Observability: Möglichkeiten zur Logging, Monitoring, Tracing Integration
19
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
Vier Kategorien von API Gateways
A. API Management Solutions


B. Build Your Own API Gateway


C. Service Proxies


D. Cloud Native API Gateways
22
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
A. API Management Solutions
23
• Ausgewachsene API Management Lösungen: Kong, Tyk, Mulesoft, 3scale,
Gravitee.io, Apigee, …


• Machen Sinn für Enterprise Use Cases. Häu
fi
g kostenp
fl
ichtig. Einige bieten
abgespeckte Open Source Varianten.


• Bieten zusätzliche features wie API Kataloge, Developer Portale, API Key
Management, Bezahlung oder Integration in EAM Lösungen


• Für gewöhnlich zentral deployed und betrieben für alle Applikationen und
Produkte im Unternehmen


• Es gilt die 80/20 Regel (wie mit jedem COTS Produkt).
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
B. Build Your Own API Gateway
24
• Zahlreiche Frameworks stehen hier zur Auswahl: Net
fl
ix Zuul 2,
Spring Cloud Gateway, Node, Vert.x, Ballerina, Java EE 8, Camel,
Express Gateway, …


• Bieten viel Flexibilität, alles was man programmieren kann geht!


• Aber: das Team muss das API Gateway entwickeln, warten und
betreiben. Das ist Aufwand und birgt Risiken!
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
C. Service Proxies
25
• Viel Auswahlmöglichkeiten: Apache, HA Proxy, Nginx, OpenResty,
Trae
fi
k, Envoy, …


• Leichtgewichtig und oft einfach in der Kon
fi
guration und Nutzung


• Die unterstützte Funktionen unterscheiden sich teilweise signi
fi
kant
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
D. Cloud Native API Gateways
26
• Wenige Möglichkeiten: KrakenD, Ambassador Edge Stack (Emissary),
Gloo, AWS API Gateway, …


• Basieren häu
fi
g auf Envoy mit zusätzlichen Erweiterung und Plugins


• Bieten eine tiefe Integration in Cloud-native Plattformen (K8s) und
Cloud Provider
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
API Gateway Composition
27
The Enterprise
API
Management
Solution
On-Premise Servers
Service
Proxy
Some Public Cloud
Managed K8s
Cloud
Gateway
A Shared PaaS
A Namespace
Custom


Gateway
Proxy
Legacy Backend
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
DEMOS
28
https://github.com/lreimer/hitchhikers-guide-api-gateways


https://github.com/lreimer/hands-on-krakend
// betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
THE ANSWER TO LIFE, UNIVERSE,


THE CLOUD, AND API GATEWAYS.
29
42.
Mario-Leander Reimer


Principal Software Architect, QAware GmbH


mario-leander.reimer@qaware.de


https://www.qaware.de


https://speakerdeck.com/lreimer/
&

Per Anhalter zu Cloud-nativen API Gateways

  • 1.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf PER ANHALTER ZU CLOUD-NATIVEN API GATEWAYS
  • 2.
    Mario-Leander Reimer Principal SoftwareArchitect @LeanderReimer #cloudnativenerd #qaware https://lreimer.github.io
  • 3.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf 3 https://imgur.com/gallery/LGAZEqu The Earl y Code Monkey The Monolith
  • 4.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf 4 Monolithic Vintage System Users system.example.com
  • 5.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf 5 autonomous bounded contexts loosely coupled stateless makeameme.org
  • 6.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf 6 Users Monolithic Vintage System A Shared PaaS A Namespace Service A system.example.com service-a.default.example.com Route
  • 7.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf 7 Users Monolithic Vintage System A Shared PaaS A Namespace Service A system.example.com service-a.default.example.com Route Service B Route service-b…
  • 8.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf 8 Users Monolithic Vintage System A Shared PaaS A Namespace Service A system.example.com service-a.default.example.com Route Service B Route service-b… Service C Route service-c…
  • 9.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf 9 Users Monolithic Vintage System A Shared PaaS A Namespace Service A’ system.example.com service-a.default.example.com Route Service B Route service-b… Service C' Route service-c… 3rd Party Apps
  • 10.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf 10 Users Monolithic Vintage System A Shared PaaS A Namespace Service A’ system.example.com service-a.default.example.com Route Service B Route service-b… Service C' Route service-c… 3rd Party Apps B Namespace Service X Service Y Service Z’ Unreliable Legacy Systems SOAP gRPC
  • 11.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf 11 Users Monolithic Vintage System A Shared PaaS A Namespace Service A’ system.example.com service-a.default.example.com Route Service B Route service-b… Service C' Route service-c… 3rd Party Apps B Namespace Service X Service Y Service Z’ Unreliable Legacy Systems SOAP gRPC Route Internal Systems
  • 12.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf 12 https://thenewstack.io/history-service-mesh/ APIs sind das Herzstück erfolgreicher, digitaler Produkte. Das richtige Management der APIs von Beginn an ist essentiell, um den 
 Big Ball of Mud zu vermeiden.
  • 13.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf 13 APIs sind das Herzstück erfolgreicher, digitaler Produkte. Das richtige Management der APIs von Beginn an ist essentiell, um den 
 Big Ball of Mud zu vermeiden. https://thenewstack.io/history-service-mesh/
  • 14.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf 14 Users Monolithic Vintage System A Shared PaaS A Namespace Service A Service B Service C 3rd Party Apps B Namespace Service X Service Y Service Z Unreliable Legacy Systems SOAP API Gateway Backend for Frontend Internal Systems API Gateway API Proxy
  • 15.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf 15 API Gateways sind wie das Façade Pattern für 
 Cloud Native Application Design und Microservice Architekturen
  • 16.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf • Tra ffi c Management: Path, Header, Host based Routing, Path Rewrite • Rollout and Deployment: A/B Deployment, Canary Release, et.al. • QoS and Resiliency: Circuit Breaker, Retry, Timeouts, Rate Limiting • Security: AAA, Terminate TLS, Support for JWT and JWKS, Open ID, … • Protocol Translation: XML to JSON, gRPC to JSON, … • Transformation: Fan Out / Collect, B4F, Versioning, GraphQL, … • Observability: Logging Integration, Monitoring, Distributed Tracing 16
  • 17.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf 17 W E N S Ingress Egress API Gateways für Nord-Süd Kommunikation Service Meshes für Ost-West Kommunikation
  • 18.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf API Gateways in a Nutshell • Vorteile • Abstraktion der internen Anwendungsstruktur • Vereinfachter Client Code • Einfaches Rollout und Deployment, Versionierung, … • B4Fs reduzieren die Anzahl benötigter Client-Server Calls 18 • Nachteile • Weiterer hoch-verfügbarer Infrastruktur-Baustein der betrieben werden muss • Wird schnell zum DevOps Flaschenhals im Fall von zentralem Betrieb • Business Logik im API Gateway führt versehentlich zu einem ESB
  • 19.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf Mögliche Kriterien für einen Vergleich • Maturity: Gute und aktive Community, keine Issues, häu fi ge Releases • License: Open Source oder Commercial • Supported Features: Tra ffi c Management, Deployment, Security, Translation, Transformation, QoS, Resiliency • DevOps Friendly: Einfaches Setup und Betreibbarkeit, Plattform, CI/CD und GitOps Support, Documentation • Performance: Kleiner Overhead, hoher Durchsatz, Skalierbarkeit, Verfügbarkeit • Observability: Möglichkeiten zur Logging, Monitoring, Tracing Integration 19
  • 22.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf Vier Kategorien von API Gateways A. API Management Solutions B. Build Your Own API Gateway C. Service Proxies D. Cloud Native API Gateways 22
  • 23.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf A. API Management Solutions 23 • Ausgewachsene API Management Lösungen: Kong, Tyk, Mulesoft, 3scale, Gravitee.io, Apigee, … • Machen Sinn für Enterprise Use Cases. Häu fi g kostenp fl ichtig. Einige bieten abgespeckte Open Source Varianten. • Bieten zusätzliche features wie API Kataloge, Developer Portale, API Key Management, Bezahlung oder Integration in EAM Lösungen • Für gewöhnlich zentral deployed und betrieben für alle Applikationen und Produkte im Unternehmen • Es gilt die 80/20 Regel (wie mit jedem COTS Produkt).
  • 24.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf B. Build Your Own API Gateway 24 • Zahlreiche Frameworks stehen hier zur Auswahl: Net fl ix Zuul 2, Spring Cloud Gateway, Node, Vert.x, Ballerina, Java EE 8, Camel, Express Gateway, … • Bieten viel Flexibilität, alles was man programmieren kann geht! • Aber: das Team muss das API Gateway entwickeln, warten und betreiben. Das ist Aufwand und birgt Risiken!
  • 25.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf C. Service Proxies 25 • Viel Auswahlmöglichkeiten: Apache, HA Proxy, Nginx, OpenResty, Trae fi k, Envoy, … • Leichtgewichtig und oft einfach in der Kon fi guration und Nutzung • Die unterstützte Funktionen unterscheiden sich teilweise signi fi kant
  • 26.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf D. Cloud Native API Gateways 26 • Wenige Möglichkeiten: KrakenD, Ambassador Edge Stack (Emissary), Gloo, AWS API Gateway, … • Basieren häu fi g auf Envoy mit zusätzlichen Erweiterung und Plugins • Bieten eine tiefe Integration in Cloud-native Plattformen (K8s) und Cloud Provider
  • 27.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf API Gateway Composition 27 The Enterprise API Management Solution On-Premise Servers Service Proxy Some Public Cloud Managed K8s Cloud Gateway A Shared PaaS A Namespace Custom Gateway Proxy Legacy Backend
  • 28.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf DEMOS 28 https://github.com/lreimer/hitchhikers-guide-api-gateways 
 https://github.com/lreimer/hands-on-krakend
  • 29.
    // betterCode() API2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf THE ANSWER TO LIFE, UNIVERSE, THE CLOUD, AND API GATEWAYS. 29 42.
  • 30.
    Mario-Leander Reimer Principal SoftwareArchitect, QAware GmbH mario-leander.reimer@qaware.de https://www.qaware.de https://speakerdeck.com/lreimer/ &