betterCode, April 2021, online: Vortrag von Mario-Leander Reimer (@LeanderReimer, Principal Software Architect bei QAware)
== Please download slides if blurred! ==
Abstract:
Gute APIs sind das Herzstück erfolgreicher digitale Produkte und Cloud-nativer Anwendungen. Doch für komplexe Systeme mit zahlreichen Abnehmern ist die ordnungsgemäße Verwaltung dieser APIs von größter Bedeutung. In diesem Vortrag werden wir das Cloud-native API-Gateway-Ökosystem näher betrachten: Ambassador, Gloo, KrakenD, Kong, Tyk et al.
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Per Anhalter zu Cloud-nativen API Gateways
1. // betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
PER ANHALTER ZU
CLOUD-NATIVEN
API GATEWAYS
3. // 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
4. // betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
4
Monolithic
Vintage System
Users
system.example.com
5. // betterCode() API 2021 // Per Anhalter zu Cloud-nativen API Gateways // @LeanderReimer #cloudnativenerd #qaware @bettercodeconf
5
autonomous bounded contexts
loosely coupled stateless
makeameme.org
6. // 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
7. // 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…
8. // 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…
9. // 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
10. // 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
11. // 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
12. // 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.
13. // 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/
14. // 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
15. // 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
16. // 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
17. // 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
18. // 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
19. // 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
20.
21.
22. // 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
23. // 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).
24. // 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!
25. // 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
26. // 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
27. // 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
28. // 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
29. // 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.