a hitchhiker’s guide to the cloud native stack

29
| ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware A HITCHHIKER’S GUIDE TO THE CLOUD NATIVE STACK 1

Upload: mario-leander-reimer

Post on 16-Apr-2017

127 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: A Hitchhiker’s Guide to the Cloud Native Stack

| ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware

A HITCHHIKER’S GUIDE TO THE CLOUD NATIVE

STACK

1

Page 2: A Hitchhiker’s Guide to the Cloud Native Stack

| ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware

Let’s talk about Cloud Native Applications

2

Page 3: A Hitchhiker’s Guide to the Cloud Native Stack

CONTINUOUS DELIVERY & DEVOPS

ANTIFRAGILITYHYPERSCALE TRAFFIC, DATA, FEATURES

OPEX SAVINGS(automation & utilization)

CLOUD NATIVE APPLICATIONS

DISR

UPT

INDU

STRI

ALIZ

E

Page 4: A Hitchhiker’s Guide to the Cloud Native Stack

| 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

Page 5: A Hitchhiker’s Guide to the Cloud Native Stack

| 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: AdaptiveCloud 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.

Page 6: A Hitchhiker’s Guide to the Cloud Native Stack

| 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.

Page 7: A Hitchhiker’s Guide to the Cloud Native Stack
Page 8: A Hitchhiker’s Guide to the Cloud Native Stack

| 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

Page 9: A Hitchhiker’s Guide to the Cloud Native Stack

| 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

Page 10: A Hitchhiker’s Guide to the Cloud Native Stack

| 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

dockercompose

Page 11: A Hitchhiker’s Guide to the Cloud Native Stack

| ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware

MICROSERVICES

11

Page 12: A Hitchhiker’s Guide to the Cloud Native Stack

| 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(…)

Page 13: A Hitchhiker’s Guide to the Cloud Native Stack

| ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware

CONTAINERIZATION

13

Page 14: A Hitchhiker’s Guide to the Cloud Native Stack

| 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

Page 15: A Hitchhiker’s Guide to the Cloud Native Stack

| 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 <[email protected]>RUN mkdir -p /appCOPY build/libs/zwitscher-service-1.0.1.jar /app/zwitscher-service.jar COPY src/main/docker/zwitscher-service.conf /app/EXPOSE 8080CMD /app/zwitscher-service.jar

Page 16: A Hitchhiker’s Guide to the Cloud Native Stack

| 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

Page 17: A Hitchhiker’s Guide to the Cloud Native Stack

| ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware

COMPOSITION

17

Page 18: A Hitchhiker’s Guide to the Cloud Native Stack

| 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

Page 19: A Hitchhiker’s Guide to the Cloud Native Stack

| 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

/adm

in/h

ealt

hRegister

Read

K/V

Get Services

Page 20: A Hitchhiker’s Guide to the Cloud Native Stack

| ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware

Beispiel docker-compose.yml

20

version: '2' services: zwitscher-consul: ... zwitscher-traefik: ... zwitscher-service: image: hitchhikersguide/zwitscher-service:1.0.1 environment: - CONSUL_HOST=zwitscher-consul - CONSUL_PORT=8500 - TWITTER_APP_ID=${TWITTER_APP_ID} - TWITTER_APP_SECRET=${TWITTER_APP_SECRET} depends_on: - zwitscher-consul links: - zwitscher-consul ports: - "8080:8080" networks: - zwitscher-net

$ docker-compose -p zwitscher up -d

$ docker-compose -p zwitscher ps $ docker-compose -p zwitscher logs -f

$ docker-compose -p zwitscher down

dockercompose

Page 21: A Hitchhiker’s Guide to the Cloud Native Stack

| ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware

ORCHESTRATION

21

Page 22: A Hitchhiker’s Guide to the Cloud Native Stack

| ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware22

zwitscher-traefik

Mesos DNS

Marathon

zwitscher-consul

zwitscher-service

Manage

Manage

Manage

Resolve zwitscher-consul.marathon.mesos

Ops

Page 23: A Hitchhiker’s Guide to the Cloud Native Stack

| ContainerConf 2016 | A Hitchhiker’s Guide to the Cloud Native Stack | @LeanderReimer #cloudnativenerd #qaware23

{ "id": "zwitscher-service-hitchhikersguide",

"instances": 3, "cpus": 0.5, "mem": 256,

"container": { "type": "DOCKER", "docker": { "image": "hitchhikersguide/zwitscher-service:1.0.1", "network": "BRIDGE", "portMappings": [{ "containerPort": 0, "hostPort": 0, "protocol": "tcp" }] } },

"healthChecks": [{ "protocol": "HTTP", "path": "/admin/health", "intervalSeconds": 10, "portIndex": 0, "maxConsecutiveFailures": 3 }] }

Page 24: A Hitchhiker’s Guide to the Cloud Native Stack
Page 25: A Hitchhiker’s Guide to the Cloud Native Stack

| 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

Page 26: A Hitchhiker’s Guide to the Cloud Native Stack

| 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 bauenhttps://goo.gl/edNlUK

• Cloud-native Anwendungen mit Kuberneteshttps://goo.gl/dVkoyR

• Eine Einführung in Apache Mesos: Das Betriebsystem der Cloudhttps://goo.gl/7SnMZA

26

Page 27: A Hitchhiker’s Guide to the Cloud Native Stack

| 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

Page 28: A Hitchhiker’s Guide to the Cloud Native Stack

| 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

Page 29: A Hitchhiker’s Guide to the Cloud Native Stack

Mario-Leander Reimer Cheftechnologe, QAware GmbH [email protected]

https://www.qaware.de https://slideshare.net/MarioLeanderReimer/ https://speakerdeck.com/lreimer/ https://twitter.com/leanderreimer/

&