ContainerConf 2016, Mannheim: Vortrag von Mario-Leander Reimer (@LeanderReimer, Cheftechnologe bei QAware).
Abstract: Cloud-Größen wie Google, Twitter und Netflix haben die Kern-Bausteine ihrer Infrastruktur quelloffen verfügbar gemacht. Das Resultat aus vielen Jahren Cloud-Erfahrung ist nun frei zugänglich, und jeder kann seine eigenen cloud-nativen Anwendungen entwickeln – Anwendungen, die in der Cloud zuverlässig laufen und fast beliebig skalieren. Die einzelnen Bausteine wachsen zu einem großen Ganzen zusammen, dem Cloud Native Stack. In dieser Session stellen wir die wichtigsten Konzepte und Schlüssel-Technologien vor, und bringen dann eine Spring Cloud basierte Beispiel Anwendung schrittweise auf Kubernetes und DC/OS zum Laufen. Dabei diskutieren wir verschiedene praktikable Architektur-Alternativen.
1. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
A
HITCHHIKER’S
GUIDE TO THE
CLOUD NATIVE
STACK
1
2. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
Let’s talk about Cloud Native Applications
2
4. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
Design Prinzipien Cloud-nativer Anwendungen
• Design for Performance: responsive; concurrency; efficiency.
• Design for Automation: automate dev tasks & ops tasks.
• Design for Resiliency: fault-tolerant; self-healing.
• Design for Elasticity: dynamically scale; be reactive.
• Design for Delivery: short roundtrips; automated delivery.
• Design for Diagnosability: cluster-wide logs, traces, metrics.
4
5. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
Maturity Model Cloud-nativer Anwendungen
5
https://www.opendatacenteralliance.org/docs/architecting_cloud_aware_applications.pdf
Level 0: Virtualized
Level 1: Loosely Coupled
Level 2: Abstracted
Level 3: Adaptive
Cloud Native
- Skaliert elastisch abhängig von Stimuli.
- Dynamische Migration auf andere Infrastruktur
ohne eine Service Downtime.
Cloud Resilient
- Fehler-tolerant und resilient entworfen.
- Metriken und Monitoring eingebaut.
- Runs anywhere. Infrastruktur agnostisch.
Cloud Friendly
- Besteht aus lose gekoppelten Diensten.
- Dienste können über Namen gefunden werden.
- 12-Factor App Principles.
Cloud Ready
- Keine Anforderungen an das Datei-System.
- Läuft auf virtualisierter Hardware.
- Self-contained, kann als Image ausgeführt werden.
6. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
Die Anatomie des Cloud Native Stack
6
Application Platform Cloud Native App
Cluster Orchestrator Applications
Cluster Scheduler Containers
Cluster Virtualization Resources
Cluster Operating System
Entkoppelt
von physischer
Hardware.
Verwaltet
Ressourcen für
die Ausführung
von Containern
Führt
Applikationen
auf dem
Cluster aus.
Stellt Ablauf-
Umgebung und
APIs für Apps
bereit.
7.
8. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
Cloud Native Stack mit Spring Cloud und DC/OS
8
Application Platform Cloud Native App
Cluster Orchestrator Applications
Cluster Scheduler Containers
Cluster Virtualization Resources
9. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
Cloud Native Stack mit Spring Cloud und K8S.
9
Application Platform Cloud Native App
Cluster Orchestrator Applications
Cluster Scheduler Containers
Cluster Virtualization Resources
10. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
Orchestration
Composition
Die 4 Schritte zur Cloud-nativen Anwendung
1. MICROSERVICES
2. CONTAINERIZATION
3. COMPOSITION
4. ORCHESTRATION
10
Containerization
Microservices
docker
compose
11. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
MICROSERVICES
11
12. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
Zwitscher Microservice in 5 Minuten
12
Zwitscher
Controller
Zwitscher
Repository
/tweets
ZwitscherServiceApp
search(…)
13. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
CONTAINERIZATION
13
14. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
$ docker build -t zwitscher-service:1.0.1 .
$ docker run --name zwitscher-service -d
-p 8080:8080 zwitscher-service:1.0.1
$ docker tag zwitscher-service:1.0.1 hitchhikersguide/zwitscher-service:latest
$ docker push hitchhikersguide/zwitscher-service
Der Containerization Workflow mit Docker
14
3. Tag & Push
2. Run
Dockerfile
1. Build
15. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
Beispiel Dockerfile für Zwitscher Service
15
FROM qaware/alpine-k8s-ibmjava8:8.0-3.10
MAINTAINER QAware GmbH <qaware-oss@qaware.de>
RUN mkdir -p /app
COPY build/libs/zwitscher-service-1.0.1.jar /app/zwitscher-service.jar
COPY src/main/docker/zwitscher-service.conf /app/
EXPOSE 8080
CMD /app/zwitscher-service.jar
16. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
Wichtige Tips für den Umgang mit Docker
• Kenne dein Base-Image! Auf die Größe kommt es an.
• Ein Docker Build muss wiederholbar sein.
• Jeder RUN Befehl erzeugt ein Layer. Nutze Mehrfachbefehle!
• Entferne temporäre Dateien.
• Veröffentliche wichtige Ports mit EXPOSE.
• Definiere Umgebungs-Variablen für wichtige Parameter.
• Nutze ein Image für alle Umgebungen.
• Versioniere deine Images.
• Verwende Tools zur QS von Dockerfiles und Images.
16
17. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
COMPOSITION
17
18. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware18
Cluster-weite
Konfiguration und
Konsensus
Überwachung und
Fehler-Diagnose
Geregelter Zugriff
auf Service
Endpoints von Außen
Registrierung und
Suche von Service
Endpoints
Laufzeit-Umgebung
für Service Endpoints
Resistenter Aufruf
von anderen
Service Endpoints
19. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware19
Zwitscher
Controller
Zwitscher
Repository
/tweets
ZwitscherServiceApp
/zwitscher-service/*
Discovery
Configure
Actuator
/admin/health
Register
Read
K/V
Get Services
25. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
Keine Magie. Aber komplexe Technologie.
• Building Distributed Systems is hard!
• Der Cloud Native Stack macht die Komplexität beherrschbar.
• Die hohe Abstraktion ist Segen und Fluch zugleich.
• Entwickler und Architekten brauchen zusätzliche Skills und Know-
How in etlichen neuen Technologien.
25
26. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
Code und Artikel zum Nachlesen unter …
• https://github.com/qaware/hitchhikers-guide-cloudnative
• Der Cloud Stack: Mesos, Kubernetes und Spring Cloud
https://goo.gl/U5cJAU
• Spring Cloud und Netflix OSS: Cloud-native Anwendungen bauen
https://goo.gl/edNlUK
• Cloud-native Anwendungen mit Kubernetes
https://goo.gl/dVkoyR
• Eine Einführung in Apache Mesos: Das Betriebsystem der Cloud
https://goo.gl/7SnMZA
26
27. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware27
CompletableFuture<SoftwareIngenieurIn> ich =
CompletableFuture.supplyAsync(()
-> erfindergeist()
.handwerksstolz()
);
CompletableFuture<Projekthaus> qaware =
CompletableFuture.supplyAsync(()
-> professionalität()
.lässigkeit()
);
Erfolg start = qaware.thenCombine(ich,
(i, q) -> i.sendeBewerbung(q))
.join();
Weiter Details unter http://www.qaware.de/karriere/#jobs
28. | ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware
42.
THE ANSWER TO LIFE, UNIVERSE,
THE CLOUD AND EVERYTHING.
28