Download - Spring Boot on Kubernetes/OpenShift
![Page 2: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/2.jpg)
developers.redhat.com
![Page 3: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/3.jpg)
Who am I ?
● Active Open Source Contributor
● Creator vert.x-maven-plugin →
https://vmp.fabric8.io/
● Contributor fabric8 platform → https://fabric8.io/
kameshsampath
Kamesh SampathDirector of Developer Experience at Red Hat
@kamesh_sampath
![Page 4: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/4.jpg)
The microservice architectural style is an approach to developing a single application as a
suite of small services, each running in its own process and communicating with lightweight
mechanisms, often an HTTP resource API.
These services are built around business capabilities and independently deployable by fully
automated deployment machinery. There is a bare minimum of centralized management of
these services, which may be written in different programming languages and use different
data storage technologies.
Martin Fowler
What is a microservice ?
![Page 5: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/5.jpg)
Microservices Properties
MyService
Monitoring
Tracing
Discovery
API
Invocation
Resilience
Pipeline
Authentication
Logging Elasticity
![Page 6: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/6.jpg)
Short History of Microservices
Continuous
Integration
via XP
1999
AWS EC2
2006
DropWizard
May 2011
Agile
Manifesto
Feb
2001
NETFLIX
to AWS
2010
Ribbon
March 2012
Hystrix
March 2012
Eureka
July 2012
Microservices
Access
Thoughtworks
Radar
March 2012
Spring Boot
Sept 2013
Microservices
Defined
Thoughtworks
Fowler, Lewis
March 2014
Kubernetes
June 2014
Java EE6
2009
DevOps
2009Containers
Docker
2013
![Page 7: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/7.jpg)
java -jar myapp.jar
DropWizard
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
Reactive
Async/non-blocking
vertx run myhttp.java
HTTP, HTTP/2, TCP,
UDP, Websockets,
etc. (out of the box)
![Page 8: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/8.jpg)
@kamesh_sampath
Java Microservices Platform circa 2014
Config Server
NETFLIX Ribbon
![Page 9: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/9.jpg)
@kamesh_sampath
Caveman’s Spring BootHow to ScaleHow to avoid
Port conflicts
Manage on
multiple hosts
How to manage
when hosts in
trouble ?
How to update
them ?
How to keep up
Desired vs Actual
states?
Where are my
containers ??
![Page 10: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/10.jpg)
@kamesh_sampath
![Page 11: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/11.jpg)
Open Container Initiative (OCI)
ImageSpecRuntime Spec (cri-o)
https://cri-o.io
https://www.opencontainers.org/
https://www.opencontainers.org/image-spec
e.g. Docker , rkt e.g. Docker formatted Images
docker.io/busybox
The Runtime Specification outlines
how to run a “filesystem bundle”
that is unpacked on disk
A container image package with
required metadata that will be used by
runtimes to run the container images
![Page 12: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/12.jpg)
▪ 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 13: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/13.jpg)
Pods
A 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 14: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/14.jpg)
OpenShift is Enterprise Kubernetes
![Page 15: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/15.jpg)
PodReplication
Controller/
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 16: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/16.jpg)
My Boot is Kube Awesome
JVM Configurations
Operating System
MyApp.jar
OCI
![Page 17: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/17.jpg)
DEMO (Hello Boot k8s deployment)
![Page 18: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/18.jpg)
@kamesh_sampath
Better Spring Boot Microservices Platform circa 2016
Config Server
NETFLIX Ribbon
![Page 19: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/19.jpg)
▪ Service Discovery
Spring Discovery Client using Kubernetes Service
Discovery
▪ ConfigMap Property Source
How to use Kubernetes ConfigMap as Spring
Property source
▪ Zipkin Service Discovery
Using Zipkin with Kubernetes for distributed tracing
Spring Cloud Kubernetes
![Page 20: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/20.jpg)
@kamesh_sampath
How to add to My Project?
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-kubernetes-discovery</artifactId>
<version>0.2.0.RELEASE</version>
</dependency>
Spring Cloud Kubernetes Discovery Spring Cloud Kubernetes Config
Spring Cloud Kubernetes ArchaiusSpring Cloud Kubernetes Netflix
Spring Cloud Kubernetes Zipkin
https://github.com/spring-cloud-incubator/spring-cloud-kubernetes
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-kubernetes-config</artifactId>
<version>0.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-kubernetes-archaius</artifactId>
<version>0.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-kubernetes-netflix</artifactId>
<version>0.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-kubernetes-config</artifactId>
<version>0.2.0.RELEASE</version>
</dependency>
![Page 21: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/21.jpg)
DEMO (Discovery)
![Page 22: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/22.jpg)
@kamesh_sampath
Better Spring Boot Microservices Platform circa 2017
Config Server
NETFLIX Ribbon
![Page 23: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/23.jpg)
@kamesh_sampath
Better Spring Boot Microservices Platform circa 2018
Config Server
NETFLIX Ribbon
Jaeger
Istio
![Page 24: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/24.jpg)
Canary release is a technique to reduce the risk of introducing a new
software version in production by slowly rolling out the change to a
small subset of users before rolling it out to the entire infrastructure and
making it available to everybody.
Source: https://martinfowler.com/bliki/CanaryRelease.html
Microservice Architecture - Principles
Canary Release
![Page 25: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/25.jpg)
![Page 26: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/26.jpg)
Canary Deployment
DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS
SCM
![Page 27: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/27.jpg)
Canary Deployment
DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS
SCM
![Page 28: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/28.jpg)
Canary Deployment
DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS
SCM
![Page 29: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/29.jpg)
Canary Deployment
DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS
SCM
![Page 30: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/30.jpg)
Canary Deployment
DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS
SCM
![Page 31: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/31.jpg)
Canary Deployment
DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS
SCM
![Page 32: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/32.jpg)
Canary Deployment
DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS
SCM
![Page 33: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/33.jpg)
Canary Deployment
DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS
SCM
![Page 34: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/34.jpg)
Canary Deployment
DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS
SCM
![Page 35: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/35.jpg)
Canary Deployment
DEVELOPMENT QA STAGING PRODUCTION ROUTER USERS
SCM
![Page 36: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/36.jpg)
Demo
![Page 37: Spring Boot on Kubernetes/OpenShift](https://reader037.vdocument.in/reader037/viewer/2022100218/5a647ae57f8b9a27568b4bc3/html5/thumbnails/37.jpg)
▪ Minishift and Minikube
▪ Fabric8 Maven Plugin
▪ Eureka & Ribbon not required with Kubernetes
▪ Demos
○bit.ly/springboot-on-openshift
○Spring Cloud Brewery Application Migration
■bit.ly/green-cloud-demo
■bit.ly/green-cloud-demo-sources
○Stateful Canary leveraging Infinispan
■bit.ly/popdemo
●Open Containers Initiative
○ Runtime Spec - http://cri-o.io/
○ Image Spec – https://github.com/opencontainers/image-spec
Summary @kamesh_sampath