microservices with docker, kubernetes, and jenkins

37
1 Microservices with Docker, Kubernetes and Jenkins Rafael Benevides & Christian Posta @rafabene / @christianposta http://bit.ly/javaone-kb8s-jenkins

Upload: red-hat-developers

Post on 08-Jan-2017

131 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: Microservices with Docker, Kubernetes, and Jenkins

1

Microservices with Docker, Kubernetes and Jenkins

Rafael Benevides & Christian Posta@rafabene / @christianposta

http://bit.ly/javaone-kb8s-jenkins

Page 2: Microservices with Docker, Kubernetes, and Jenkins

Christian PostaPrincipal Middleware Architect at Red Hat

[email protected] @christianposta

● Author “Microservices for Java Developers”● Committer Apache Camel, ActiveMQ,

ActiveMQ PMC, Fabric8.io● Worked with large Microservices, web-scale

companies● Blogger, speaker about microservices,

DevOps, cloud, distributed systems, messaging

Page 3: Microservices with Docker, Kubernetes, and Jenkins

Rafael BenevidesDirector of Developer Experience at Red HatApache DeltaSpike P.M.C

[email protected] @rafabene

Java Certifications:SCJA / SCJP / SCWCD / SCBCD / SCEA

JBoss Certifications: JBCD / JBCAA

Red Hat Certifications: OpenShift / Containers / Ansible

Other Certifications:SAP Netweaver / ITIL / IBM Software Quality

Page 4: Microservices with Docker, Kubernetes, and Jenkins

developers.redhat.com

http://developers.redhat.comhttp://developers.redhat.com

Page 5: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Why do you want to run your application inside containers?

Page 6: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

● Lightweight footprint and minimal overhead,● Portability across machines,● Simplify DevOps practices,● Speeds up Continuous Integration,● Empower Microservices Architectures.● Isolation

ContainerAdvantages

Container Engine

Page 7: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

A way to run a Linux container:

$ docker run -d <image-name>

A single and isolated Linux process running in a single machine

Page 8: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

DevOps challenges for multiple containers

● How to scale?

● How to avoid port conflicts?

● How to manage them in multiple hosts?

● What happens if a host has a trouble?

● How to keep them running?

● How to update them?

● Where are my containers?

Node Node

Logger

Node

Node Node Node

Page 9: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

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 10: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Version 1.3

Hosted on GitHub

800+ contributors

34,000+ commits

16,000+ GitHub stars

Red Hat

HP

IBM

Mesosphere

Microsoft

Project Partners

CoreOS

Pivotal

SaltStack

VMWare

http://kubernetes.io/

https://github.com/kubernetes/kubernetes

Open Source community

Page 11: Microservices with Docker, Kubernetes, and Jenkins

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- Replication- Services- Builds- Routes- Deployment

Kubernetes

OpenShift- Deployments- Builds- ImageStreams

Page 12: Microservices with Docker, Kubernetes, and Jenkins

@rafabene developers.redhat.com

Kubernetes Concepts

Pod ReplicationController

Service Label

One or More ContainersShared IPShared Storage VolumeShared ResourcesShared Lifecycle

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

Grouping of pods, act as one, has stable virtual IP and DNS name

Key/Value pairs associated with Kubernetes objects(e.g. env=production)

Page 13: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Concept: Pod

● Group of containers● Live and die together● Share:

○ IP○ Secrets○ Volumes○ Labels *

* we will talk about labels later

Labels

Application

Administrative console

Log collector

IP: 10.x.x.x

Volume

Page 14: Microservices with Docker, Kubernetes, and Jenkins

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- Replication- Services- Builds- Routes- Deployment

Kubernetes

OpenShift- Deployments- Builds- ImageStreams

Page 15: Microservices with Docker, Kubernetes, and Jenkins

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- Replication- Services- Builds- Routes- Deployment

Kubernetes

OpenShift- Deployments- Builds- ImageStreams

Page 16: Microservices with Docker, Kubernetes, and Jenkins

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- Replication- Services- Builds- Routes- Deployment

Kubernetes

OpenShift- Deployments- Builds- ImageStreams

Page 17: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Concept: Labels

App: CoolEnv: DevVersion: 1.0

App: CoolEnv: ProdVersion: 1.0

App: CoolEnv: DevVersion: 2.0

App: CoolEnv: ProdVersion: 2.0

Everything in Kubernetes can have a label

Node

Logger

Node

NodeNode

Page 18: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Concept: Labels

App: CoolEnv: DevVersion: 1.0

App: CoolEnv: ProdVersion: 1.0

App: CoolEnv: DevVersion: 2.0

App: CoolEnv: ProdVersion: 2.0

Logger

Node

NodeNode

Node

Page 19: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Concept: Labels

App: CoolEnv: DevVersion: 1.0

App: CoolEnv: ProdVersion: 1.0

App: CoolEnv: DevVersion: 2.0

App: CoolEnv: ProdVersion: 2.0

Logger

Node

Node

Node

Node

Page 20: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Node 2

POD

App: CoolEnv: ProdVersion: 1.0

POD

ServiceLabels selector:● App=Cool● Env=Prod

IP: 172.x.x.xApp: NiceEnv: ProdVersion: 1.0

Concept: Services

Node 1

POD

Page 21: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Using Environment variables:

Using internal DNS: $ ping mysql

Service discovery

Page 22: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Deployment Concept: Rolling Updates

Pod

ReplicationController

Pod Pod Pod

App: CoolVersion: 1.0

Version: 1.0Replicas: 4

Backend

ReplicationController

Version: 2.0Replicas: 1

PodPod Pod Pod

App: CoolVersion: 2.0

Version: 1.0Replicas: 3

Version: 2.0Replicas: 2

Version: 1.0Replicas: 2

Version: 2.0Replicas: 3

Version: 1.0Replicas: 1

Version: 2.0Replicas: 4

Page 23: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

If you want to know more about Kubernetes, joinThe "Kubernertes for Java Developers" lab

Wednesday, Sep 21, 12:30 p.m. - 2:30 p.m. Hilton - Franciscan Room C/D

Page 24: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Page 25: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Hello World Service - Greet

Guestbook Service - Create

Guestbook Service - Retrieve

Page 26: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Creating business value through software is about speed, safety, iteration, and continuous improvement

Page 27: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Page 28: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

How do we deliver value fast (and safely)?

ANSWER:Continuous delivery of containerized microservices

Page 29: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Challenges of microservices CI/CD

● Lots of independent teams want their own

○ flexible pipelines

○ Environments (Dev/IST/UAT/Prod)

○ Resources (compute, network, storage)

● Automation because we have lots of microservices

○ Creation of projects, CD pipelines, environments, releases, etc.

Page 30: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Jenkins and Kubernetes is kinda groovy!

Jenkins Pipeline + Jenkins Kubernetes Plugin Rocks!

Page 31: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Fabric8 all the things!● Built on top of Kubernetes

● Wizards to create microservices

● Package as immutable containers

● Rolling upgrade across environments

● 1-Click install of fully configured CI/CD (Jenkins Pipeline, Nexus, Git)

● Feedback loops

● Lots of developer toolinghttp://fabric8.io

Page 32: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Fabric8 stands on the shoulder of giants

Page 33: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

And more giants...

Page 34: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

And more giants...

Page 35: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Did I mention giants...

Page 36: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Getting started with Fabric8 on Kubernetes● Kubernetes

○ Google Container Engine (GKE)http://cloud.google.com/container-engine

○ Amazon, Azure, Digital Ocean, et.al.https://stackpoint.io

○ On premise:http://kubernetes.io

● OpenShift (Enterprise Kubernetes)

○ https://openshift.com

● Then deploy fabric8 with gofabric8 deploy

○ https://github.com/fabric8io/gofabric8http://fabric8.io

Page 37: Microservices with Docker, Kubernetes, and Jenkins

@rafabene and @christianposta

Demo Time!! Please reach out with questions!

Rafael Benevides@rafabene

[email protected]

Christian Posta@christianposta

[email protected]