SlideShare a Scribd company logo
Kubernetes & Co, beyond
the hype
10 tips for designers who want to create cloud native apps
Alexandre Touret
Architect / Developer
#Java #API #CI #Cloud
#Software_Craftsmanship
2
@touret_alex https://blog.touret.info
Some context...
1.
4
Used technologies
5
Do you REALLY
need it?
Small business application
Controlled scope
Automatized deployments already implemented
7
What are the NFRs?
Do you have constraining SLOs?
(eg. >99% SLA availability)
Does your system need to be dynamically scaled?
8
Providing « on
demand » environments
9
Do you need to deliver environments on demand (and really
fast)?
Docker & Cie
basics
11
You will have to
know…
12
13
Organization
«Any organization that designs a
system (defined broadly) will
produce a design whose structure
is a copy of the organization's
communication structure.»
— M. Conway
15
What’s the associated RACI ?
Is your organisation compatible?
16
RACI &
Responsabilies
The stateless
apps and the
others…
18
Codebase
One codebase tracked in revision
control, many deploys
Dependencies
Explicitly declare and isolate
dependencies
Config
Store config in the environment
Backing Services
Treat backing services as attached
resources
Build, release, run
Strictly separate build and run
stages
Backing Services
Treat backing services as attached
resources
Processes
Execute the app as one or more
stateless processes
Port Binding
Export services via port binding
Disposability
Maximize robustness with fast
startup and graceful shutdown
Dev/prod parity
Keep development, staging, and
production as similar as possible
Logs
Treat logs as event streams
Admin processes
Run admin/management tasks as
one-off processes
Source: https://12factors.net
19
For an API
(Fast)
application
startup
21
Choose wisely your
frameworks and
target runtime
platforms
23
24
Items to check
✓ Fast startup
✓ Shutdown handling
✓ Ability to be integrated into Docker and K8S
✓ Observability
✓ Memory and CPU consumption
✓ Dependency and patch management
TOMCAT vs FAT JARS
→ Production – Development teams trade-off
25
Observability
Address this point from
design phase
Don’t wait for the production deployment
Expose your system status through endpoints
Be careful to the used FRAMEWORKS
27
liveness &
readiness probes
livenessProbe:
failureThreshold: 3
httpGet:
path: /actuator/health/liveness
port: http
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
28
readinessProbe:
failureThreshold: 3
httpGet:
path: /actuator/health/readiness
port: http
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 1
Spring Actuator
management.health.probes.enabled=true
management.endpoints.enabled-by-default=true
management.health.livenessstate.enabled=true
management.health.readinessstate.enabled=true
management.endpoint.health.show-details=always
management.endpoint.health.probes.enabled=true
management.endpoint.health.enabled=true
LivenessStateHealthIndicator
&
ReadinessStateHealthIndicator
29
30
@Component
public class MongoDBActuatorHealthIndicator implements HealthIndicator {
[...]
@Override
public Health health() {
// ping database
}
@Override
public Health getHealth(boolean includeDetails) {
if (!includeDetails) {
return health();
} else {
var statuses = mongoDBHealthService.findStatusForAllConfigurations();
return Health.status(checkStatus(statuses)).withDetails(statuses).build();
}
}
[...]
}
Monitoring
▪ Micrometer
▪ Prometheus
▪ Grafana
31
32
management:
endpoints:
enabled-by-default: true
web:
exposure:
include: '*'
jmx:
exposure:
include: '*'
endpoint:
health:
show-details: always
enabled: true
probes:
enabled: true
shutdown:
enabled: true
prometheus:
enabled: true
metrics:
enabled: true
health:
livenessstate:
enabled: true
readinessstate:
enabled: true
datasource:
enabled: true
metrics:
web:
client:
request:
autotime:
enabled: true
Actuator
configuration
Metrics
configuration
Kubernetes & Co, beyond the hype
Steps to integrate in
your CI/CD pipeline
✓ Unit and integration tests
✓ Docker image creation
✓ Created docker image “Smoke tests”
✓ Continuous deployment of your develop branch
✓ HELM charts deployment
✓ Release deployment
✓ ...
34
Example
Spring Boot, Tomcat, JDK Migration
Tested locally → Dev → Staging
⇒ In one day
35
Configuration
37
▪ Environment variables
▪ Config Maps
▪ Secrets
Environment
variables
spec:
containers:
- env:
- name: JAVA_OPTS
value: >-
-XX:+UseContainerSupport -XX:MaxRAMPercentage=70.0
-Dfile.encoding=UTF-8 -
Djava.security.egd=file:/dev/./urandom
38
Config maps
apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: 2021-03-11T18:38:34Z
name: my-config-map
[...]
data:
JAVA_OPTS: >-
-XX:+UseContainerSupport -XX:MaxRAMPercentage=70.0
-Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom
39
What about
configuration files?
We can specify them as variables in config maps
We can also externalize them
40
Files in config
maps
volumeMounts:
- mountPath: /config
name: configuration-volume
readOnly: true
[...]
volumes:
- configMap:
defaultMode: 420
name: configuration
name: configuration-volume
41
apiVersion: v1
kind: ConfigMap
[...]
data:
my.conf: {{- (.Files.Glob
"conf/*").AsConfig | nindent 2 }}
Externalize values
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
labels:
[...]
spec:
maxReplicas: {{ .Values.myapp.maxReplicaCount }}
minReplicas: {{ .Values.myapp.minReplicaCount }}
[...]
targetCPUUtilizationPercentage: {{ .Values.myapp.replicationThreesold }} 42
Values.yml
myapp:
minReplicaCount: "2"
maxReplicaCount: "6"
replicationThreesold: 80
43
File templates
apiVersion: v1
kind: ConfigMap
metadata:
name: configuration
labels:
[...]
data:
application.properties:
|-
{{ tpl (.Files.Get "conf/application.properties") . | nindent 4}}
44
Templates
application.properties file
logging.level.org.hibernate.stat={{
.Values.configmap.application.org_hib
ernate_stat }}
logging.level.org.springframework.sec
urity={{
.Values.configmap.application.org_spr
ingframework_security }}
45
values.yml file
configmap:
application:
org_hibernate_stat: ERROR
org_springframework_security:
ERROR
Binary files
apiVersion: v1
# Definition of secrets
kind: Secret
[...]
type: Opaque
# Inclusion of binary configuration files
data:
my_keystore.jks: {{ .Files.Get "secrets/my_keystore.jks" | b64enc }}
46
Efficiently
logging
Log management
In the console:
kubectl logs --tail
Logs aggregator (ex. ELK)
48
Docker containers
output stream
stdout & stderr
It’s useless to setup a file output stream
49
Best practices
Indicate in your LOGS:
Container informations (image name, container ID,…)
Kubernetes related informations (POD @IP, POD ID,
namespace,...)
Log4j Docker Support – Log4j Kubernetes Support
50
To go further
You can identify the related informations of the APIs calls:
Caller ID, Correlation ID, request data,…
zalando/logbook: An extensible Java library for HTTP request and response
logging
51
Distributed tracing
You can identify and correlate your API calls on your
microservices based architecture by implement
Opentracing
52
53
Thanks!
Any question?
54

More Related Content

PDF
Introduction to WebMvc.fn
PDF
Live Coding 12 Factor App
PDF
Weaving Through the Mesh: Making Sense of Istio and Overlapping Technologies
PDF
Spring Up Your Graph
PPTX
Dropwizard Restful 微服務 (microservice) 初探 - JCConf TW 2014
PDF
Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...
PDF
Spring Boot Revisited with KoFu and JaFu
PDF
Dropwizard Spring - the perfect Java REST server stack
Introduction to WebMvc.fn
Live Coding 12 Factor App
Weaving Through the Mesh: Making Sense of Istio and Overlapping Technologies
Spring Up Your Graph
Dropwizard Restful 微服務 (microservice) 初探 - JCConf TW 2014
Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...
Spring Boot Revisited with KoFu and JaFu
Dropwizard Spring - the perfect Java REST server stack

What's hot (20)

PDF
Advanced Cojure Microservices
PDF
Spring Boot Loves K8s
PPTX
Spring Testing, Fight for the Context
PDF
OpenDaylight Developers Experience 1.5: Eclipse Setup, HOT reload, future plans
PDF
Oleksandr Navka How I Configure Infrastructure of My Project
PDF
Java 9 Modularity in Action
PDF
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
PDF
Micronaut: Changing the Micro Future
PDF
Spring boot microservice metrics monitoring
DOCX
To study pcms pegasus erp cargo management system-release-7 from architectu...
PDF
1 y0 253-q&a-demo-certmagic
PPTX
Springboot Microservices
PDF
Micronaut For Single Page Apps
PDF
GR8Conf 2011: Grails, how to plug in
PDF
Testing with JUnit 5 and Spring
PDF
Micronaut Launchpad
KEY
Scala & Lift (JEEConf 2012)
PDF
ThoughtWorks Technology Radar Roadshow - Brisbane
Advanced Cojure Microservices
Spring Boot Loves K8s
Spring Testing, Fight for the Context
OpenDaylight Developers Experience 1.5: Eclipse Setup, HOT reload, future plans
Oleksandr Navka How I Configure Infrastructure of My Project
Java 9 Modularity in Action
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
Micronaut: Changing the Micro Future
Spring boot microservice metrics monitoring
To study pcms pegasus erp cargo management system-release-7 from architectu...
1 y0 253-q&a-demo-certmagic
Springboot Microservices
Micronaut For Single Page Apps
GR8Conf 2011: Grails, how to plug in
Testing with JUnit 5 and Spring
Micronaut Launchpad
Scala & Lift (JEEConf 2012)
ThoughtWorks Technology Radar Roadshow - Brisbane
Ad

Similar to Kubernetes & Co, beyond the hype (20)

PPTX
Build12 factorappusingmp
PDF
Integration in the Cloud, by Rob Davies
PDF
Xpdays: Kubernetes CI-CD Frameworks Case Study
PDF
Beyond 12 Factor - Developing Cloud Native Applications
PDF
Kubernetes Best Practices 1st Edition Brendan Burns Eddie Villalba
PPTX
Continuous deployment of polyglot microservices: A practical approach
PDF
Immediate download Kubernetes Best Practices 1st Edition Brendan Burns ebooks...
PDF
Microservices Architecture In The Real World: Mason Jones
PDF
Azure meetup cloud native concepts - may 28th 2018
PDF
CNCF Webinar Series: "Creating an Effective Developer Experience on Kubernetes"
PDF
Kubecon seattle 2018 workshop slides
PPTX
Disruptive Trends in Application Development
PDF
Cloud Computing as Innovation Hub - Mohammad Fairus Khalid
PDF
DNUG46 - Build your own private Cloud environment
PDF
Build your own private Cloud environment
PDF
The Need of Cloud-Native Application
PPTX
Microservices with Node and Docker
PDF
Cloud-native Patterns (July 4th, 2019)
PDF
Cloud-native Patterns
PPTX
The twelve factor app
Build12 factorappusingmp
Integration in the Cloud, by Rob Davies
Xpdays: Kubernetes CI-CD Frameworks Case Study
Beyond 12 Factor - Developing Cloud Native Applications
Kubernetes Best Practices 1st Edition Brendan Burns Eddie Villalba
Continuous deployment of polyglot microservices: A practical approach
Immediate download Kubernetes Best Practices 1st Edition Brendan Burns ebooks...
Microservices Architecture In The Real World: Mason Jones
Azure meetup cloud native concepts - may 28th 2018
CNCF Webinar Series: "Creating an Effective Developer Experience on Kubernetes"
Kubecon seattle 2018 workshop slides
Disruptive Trends in Application Development
Cloud Computing as Innovation Hub - Mohammad Fairus Khalid
DNUG46 - Build your own private Cloud environment
Build your own private Cloud environment
The Need of Cloud-Native Application
Microservices with Node and Docker
Cloud-native Patterns (July 4th, 2019)
Cloud-native Patterns
The twelve factor app
Ad

More from Alexandre Touret (8)

PDF
Améliorer les compétences et intrastructures avec les katas d'architecture
PDF
Checklist pour concevoir une application dans le cloud.10 conseils à l'attent...
PDF
Checklist pour concevoir une application dans le cloud.10 conseils à l'attent...
PDF
Améliorer les compétences et intrastructures avec les katas d'architecture
PPTX
[tours-jug19] Unifiez vos traitements Batch et Streaming avec Apache beam
PPTX
[orleans-tech-19] Unifiez vos traitements Batch et Streaming avec Apache beam
PPTX
[TNT19] Hands on: Objectif Top Architecte!
PDF
Jenkins2 : le retour ( d'expérience) : TouraineTech 2018
Améliorer les compétences et intrastructures avec les katas d'architecture
Checklist pour concevoir une application dans le cloud.10 conseils à l'attent...
Checklist pour concevoir une application dans le cloud.10 conseils à l'attent...
Améliorer les compétences et intrastructures avec les katas d'architecture
[tours-jug19] Unifiez vos traitements Batch et Streaming avec Apache beam
[orleans-tech-19] Unifiez vos traitements Batch et Streaming avec Apache beam
[TNT19] Hands on: Objectif Top Architecte!
Jenkins2 : le retour ( d'expérience) : TouraineTech 2018

Recently uploaded (20)

PPTX
Tablets And Capsule Preformulation Of Paracetamol
DOC
LSTM毕业证学历认证,利物浦大学毕业证学历认证怎么认证
PPTX
Impressionism_PostImpressionism_Presentation.pptx
PPTX
nose tajweed for the arabic alphabets for the responsive
PPTX
Lesson-7-Gas. -Exchange_074636.pptx
PDF
COLEAD A2F approach and Theory of Change
PDF
PM Narendra Modi's speech from Red Fort on 79th Independence Day.pdf
PPTX
chapter8-180915055454bycuufucdghrwtrt.pptx
PPTX
Research Process - Research Methods course
PPTX
Phylogeny and disease transmission of Dipteran Fly (ppt).pptx
PDF
Yusen Logistics Group Sustainability Report 2024.pdf
PDF
Microsoft-365-Administrator-s-Guide_.pdf
PPTX
MERISTEMATIC TISSUES (MERISTEMS) PPT PUBLIC
PPTX
3RD-Q 2022_EMPLOYEE RELATION - Copy.pptx
PPT
First Aid Training Presentation Slides.ppt
PPTX
lesson6-211001025531lesson plan ppt.pptx
PPTX
NORMAN_RESEARCH_PRESENTATION.in education
DOCX
Action plan to easily understanding okey
PPTX
AcademyNaturalLanguageProcessing-EN-ILT-M02-Introduction.pptx
PPTX
FINAL TEST 3C_OCTAVIA RAMADHANI SANTOSO-1.pptx
Tablets And Capsule Preformulation Of Paracetamol
LSTM毕业证学历认证,利物浦大学毕业证学历认证怎么认证
Impressionism_PostImpressionism_Presentation.pptx
nose tajweed for the arabic alphabets for the responsive
Lesson-7-Gas. -Exchange_074636.pptx
COLEAD A2F approach and Theory of Change
PM Narendra Modi's speech from Red Fort on 79th Independence Day.pdf
chapter8-180915055454bycuufucdghrwtrt.pptx
Research Process - Research Methods course
Phylogeny and disease transmission of Dipteran Fly (ppt).pptx
Yusen Logistics Group Sustainability Report 2024.pdf
Microsoft-365-Administrator-s-Guide_.pdf
MERISTEMATIC TISSUES (MERISTEMS) PPT PUBLIC
3RD-Q 2022_EMPLOYEE RELATION - Copy.pptx
First Aid Training Presentation Slides.ppt
lesson6-211001025531lesson plan ppt.pptx
NORMAN_RESEARCH_PRESENTATION.in education
Action plan to easily understanding okey
AcademyNaturalLanguageProcessing-EN-ILT-M02-Introduction.pptx
FINAL TEST 3C_OCTAVIA RAMADHANI SANTOSO-1.pptx

Kubernetes & Co, beyond the hype