Microservices with Docker, Kubernetes, and Jenkins
-
Upload
red-hat-developers -
Category
Technology
-
view
135 -
download
5
Transcript of 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
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
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
developers.redhat.com
http://developers.redhat.comhttp://developers.redhat.com
@rafabene and @christianposta
Why do you want to run your application inside containers?
@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
@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
@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
@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
@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
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
@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)
@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
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
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
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
@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
@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
@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
@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
@rafabene and @christianposta
Using Environment variables:
Using internal DNS: $ ping mysql
Service discovery
@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
@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
@rafabene and @christianposta
@rafabene and @christianposta
Hello World Service - Greet
Guestbook Service - Create
Guestbook Service - Retrieve
@rafabene and @christianposta
Creating business value through software is about speed, safety, iteration, and continuous improvement
@rafabene and @christianposta
@rafabene and @christianposta
How do we deliver value fast (and safely)?
ANSWER:Continuous delivery of containerized microservices
@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.
@rafabene and @christianposta
Jenkins and Kubernetes is kinda groovy!
Jenkins Pipeline + Jenkins Kubernetes Plugin Rocks!
@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
@rafabene and @christianposta
Fabric8 stands on the shoulder of giants
@rafabene and @christianposta
And more giants...
@rafabene and @christianposta
And more giants...
@rafabene and @christianposta
Did I mention giants...
@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
@rafabene and @christianposta
Demo Time!! Please reach out with questions!
Rafael Benevides@rafabene
Christian Posta@christianposta