cloud native java with kubernetes - burr sutter · cloud native java with kubernetes....

50
@burrsutter [email protected] Cloud Native Java with Kubernetes

Upload: others

Post on 22-May-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

@burrsutter [email protected]

Cloud Native Java with Kubernetes

Page 2: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

developers.redhat.com

Page 3: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

We cannot solve our problems with the same thinking we used

when we created them. Albert Einstein (Theoretical

Physicist)

Page 4: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Self-Service,On-Demand,

ElasticInfrastructure

AutomationPuppet, Chef,

Ansible,Kubernetes

CI & CDDeployment

Pipeline

AdvancedDeploymentTechniques

Microservices(and flying elephants!)

Re-Org to DevOps

Digital Darwinism The Developer’s Journey

Page 5: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Our IT World Morphs

Page 6: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster
Page 7: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster
Page 8: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster
Page 9: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster
Page 10: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

java -jar myapp.jarDropWizard

www.dropwizard.io

JAX-RS API

First to market

DropWizard Metrics

Embeddable servers:Jetty

Spring Boot

projects.spring.io/spring-boot

Spring API (@RestController)

‘Starter’ POMs: start.spring.io

Embeddable servers:Tomcat, Jetty, Undertow

WildFly Swarm

wildfly-swarm.io

Java EE 7 APIs

‘Starter’ POMs: wildfly-swarm.io/generator

Embeddable servers:WildFly (Undertow)

Vert.x

vertx.io

ReactiveAsync/non-blocking

vertx run myhttp.java

HTTP, HTTP/2, TCP, UDP, Websockets, etc. (out of the box)

Page 11: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

@burrsutter

Microservices Properties

MyService

Monitoring

Tracing

Discovery

API

Invocation

Resilience

Pipeline

Authentication

Logging Elasticity

Page 12: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster
Page 13: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Your Stack Matters

Server Hardware

Operating System

Application Server

your.war

Java Virtual Machine

Custom Configuration

Linux Kernel Version & Distribution

Java 1.6.6_45 or Java 1.7.0_67

Weblogic 10.x.y, Tomcat 6.x.y, JBoss EAP 6.x.y

JDBC driver, datasource, JMS queue, users

Page 14: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

DevOps Challenges for Multiple Containers▪ How to scale?▪ How to avoid port conflicts?▪ How to manage them on

multiple hosts?▪ What happens if a host has

trouble?▪ How to keep them running?▪ How to update them?▪ Where are my containers?

Node

Node Node

Node Node

Logger

Node

Page 15: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster
Page 16: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

▪ Greek for “Helmsman,” also the root of the word “Governor” (from latin: gubernator)

▪ Container orchestrator ▪ Supports multiple cloud and bare-metal

environments▪ Inspired by Google’s experience with containers▪ Open source, written in Go▪ Manage applications, not machines

Meet Kubernetes

Page 17: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Ops

Dev

Master

api

etcd

scheduler

controllers

Kubernetes Cluster

Node

Node Node

Node Node

Logger

Node

Page 18: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

PodReplicationController/

Deployment

Service Label

✓ 1+ containers✓ Shared IP✓ Shared storage volume✓ Shared resources✓ Shared lifecycle

✓ Ensures that a specified number of pod replicas are running at any one time

✓ Grouping of pods (acting as one) has stable virtual IP and DNS name

✓ Key/Value pairs associated with Kubernetes objects(env=production)

Kubernetes Cluster

Page 19: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

PodsA group of whales is commonly referred to as a pod and a pod usually consists a group of whales that have bonded together either because of biological reasons or through friendships developed between two or more whales.

In many cases a typical whale pod consists of anywhere from 2 to 30 whales or more.*

*http://www.whalefacts.org/what-is-a-group-of-whales-called/

Page 20: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Master

API Server

Service Layer

VirtualPhysical Private Public

PersistentStorage

Node Node

Logger

Node

Node Node Node

Dev

Ops

SCM(Git/Svn)

CI/CD

Automation

Routing LayerRegistry

SDN Overlay Network

Controllers- Scheduler- Deployments- Services- Builds- Routes- DeploymentConfigs

Kubernetes

OpenShift- Builds- ImageStreams

Page 21: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

openshift.org

Page 22: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

SCM(Git/Svn)

Master

API Server

Service Layer

VirtualPhysical Private Public

PersistentStorage

Node Node

Logger

Node

Node Node Node

Dev

Ops

CI/CD

Automation

Routing LayerRegistry

SDN Overlay Network

Controllers- Scheduler- Deployments- Services- Builds- Routes- DeploymentConfigs

Kubernetes

OpenShift- Builds- ImageStreams

Page 23: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

SCM(Git/Svn)

Master

API Server

Service Layer

VirtualPhysical Private Public

PersistentStorage

Node Node

Logger

Node

Node Node Node

Dev

Ops

CI/CD

Automation

Routing LayerRegistry

SDN Overlay Network

Controllers- Scheduler- Deployments- Services- Builds- Routes- DeploymentConfigs

Kubernetes

OpenShift- Builds- ImageStreams

Page 24: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

SCM(Git/Svn)

Master

API Server

Service Layer

VirtualPhysical Private Public

PersistentStorage

Node Node

Logger

Node

Node Node Node

Dev

Ops

CI/CD

Automation

Routing LayerRegistry

SDN Overlay Network

Controllers- Scheduler- Deployments- Services- Builds- Routes- DeploymentConfigs

Kubernetes

OpenShift- Builds- ImageStreams

Page 25: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Kubernetes Demohttps://github.com/burrsutter/kube4docker

Recorded Demo: https://youtu.be/AoDhQt8PtUQ

Page 26: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

The job of a deployment pipeline is to prove that the release candidate is unreleasable.

Jez Humble

Page 27: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Starts with a “git commit and git push”

Blue/Green Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

BUILDSCM

Page 28: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Blue/Green Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

BUILDSCM

Page 29: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Blue/Green Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

BUILDSCM

Page 30: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Blue/Green Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

BUILDSCM

Page 31: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Blue/Green Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

BUILDSCM

Page 32: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Blue/Green Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 33: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Blue/Green Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 34: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster
Page 35: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 36: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 37: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 38: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 39: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 40: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 41: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 42: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 43: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 44: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Canary Deployment

DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS

SCM

Page 45: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Infinispan.orgIN-MEMORY DATA = All data needed is to kept in memoryGRID = Too big for one node, data is scaled-out in cluster

Analytical Framework

Custom Applications

Mobile Applications

Web Apps & Websites

Fuse "memory" across machines into a unified data store

Read-through, write-through, write-behind

• NoSQL• Extreme Performance• Linear Scalability• Fault Tolerant• Event processing• Configurable ACID Txn

Infinispan/Red Hat JBoss Data Grid

Databases and/or file system

Page 46: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Demo

Page 47: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Sidecars

Page 48: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Sidecars

GoConsul

ScalaCNCF

Go

C++

https://news.ycombinator.com/item?id=14194026

Pod

AppA Sidecar

Pod

AppB

Sidecar

Page 49: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

Summary▪ Minishift and Minikube▪ Fabric8 Maven Plugin▪ Eureka & Ribbon not required with Kubernetes▪ Sidecars: Envoy, LinkerD, Traefik.io, etc.

▪ Microservices, Blue/Green, CI/CD & Canary bit.ly/msa-instructions▪ Liveness and Readiness Probes▪ Stateful Canary leveraging Infinispan

▪ https://github.com/burrsutter/devoxxUK17_kubernetes

@burrsutter

developers.redhat.com

Page 50: Cloud Native Java with Kubernetes - Burr Sutter · Cloud Native Java with Kubernetes. developers.redhat.com. We cannot solve our problems ... (env=production) Kubernetes Cluster

More Information

THANK YOU!

@burrsutterhttp://bit.ly/msa-instructions