SlideShare a Scribd company logo
Ultimate Guide to
Microservice Architecture
on Kubernetes
Huseyin BABAL
Software & DevOps Consultant
Who Am I?
Software & DevOps Consultant
Ex-Sony and Ex-eBay Engineer (Microservice Transformation Project Architect)
Google Developer Expert on Web Technologies
Organizer of Docker Istanbul, NodeSchool Istanbul, DevOps Underground meetups
Who we are ?
● Microservice Transition
● DevOps as A Service
● Test Automation as A Service
● Managed Kubernetes
Who we are ?
Customers
Ready to Start ?
Once upon a time while we are in monolithic app
days
After switching to Microservice Architecture ...
And yes, the truth is, only the name Microservice Architecture cannot solve your
architectural problems.
You need to consider applying best practices to Microservices to do it in an efficient
way
#1 Try to Reach Glory of
REST
Leonard Richardson’s Maturity Model
#2 Use HATEOAS
HATEOAS
Hypermedia As The Engine Of Application State
User Model
Article Model
Article Resource
User Resource
Article Controller
User Controller
The Result
Pro Tip
If you don’t want to convert models/dtos to resources manually, you can use Resource
Assembler.
#3 Distributed Configuration
Why Not Project Specific Configs?
● Sensitive data walks around Git
● Unable to inherit common properties like spring.main.banner-mode=OFF
How to Centralized Config?
● Consul can be used to keep config data as Key/Value
● Create a project for just keeping project configurations.
● Git2Consul for sync configuration to Consul
Architecture
Git2Consull
Daemon
Config Project
Git push new config change
Polling
Sync configs to Consul
User
Spring Boot Config
Spring Boot Config (Test)
Git2Consul
npm install -g git2consul
Create a file called git2consul.json and add necessary config
git2consul --endpoint <consul_host> --port 8500 --config-file git2consul.json
Git2Consul Config File
Pro Tip
By default, Spring Boot refreshes its context on config change on Consul. This may
cause down time problems, so disable config change watching with following.
#4 Client Code Generation
How?
You can either use Swagger to generate your client code on any supported language, or
feign client with a little annotation and client side load balancing with Ribbon.
Feign Client
Swagger Doc
Swagger Doc
Now you are able to access;
http://your_api/swagger-ui.html for api documentation
http://your_api/v2/api-docs for json specification of API doc.
Swagger Codegen
Pro Tip
The best place to generate api client is while Jenkins build section.
● If you are deploying a feature to non-prod environment you can generate client
library with snapshot version and push to nexus.
● If you are deploying a feature to prod environment, you can generate client with
stable and push to nexus artifactory
#5 k8s Warm-up
Project Structure
deployment.yml
service.yml
Kubectl configuration
Kubectl is a client app for k8s api server in order to manage k8s cluster. If you use
minikube, your kubectl will be automatically configured, and it is different for other
cloud providers.
Simple deployment
git clone <http://project>
cd <project>
kubectl apply -f k8s
Event
Service
(LB)
Pod-1
Pod-2
Pod-3
Internet
#6 CI / CD
Build
Test
Deploy
Cloud
Provider
Ultimate Guide to Microservice Architecture on Kubernetes
Slack Notifications
Deployment Script
Deployment Types
● Rolling Update
● Canary Deployment
● Blue / Green Deployment
Rolling Update
Deployment resource on k8s uses RollingUpdate strategy by default. Within this
strategy, pods deployed one by one instead of taking entire service down.
Canary Deployment
You deploy an experimental feature and allow small amount of request traffic to this
deployment. You increment the size of traffic and after a while, canary replaces the
production one
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
After a while...
You confirmed that, the feature on canary deployment works, replace prod image with
canary one and delete canary deployment
Ultimate Guide to Microservice Architecture on Kubernetes
Blue & Green Deployment
In this strategy, there will be 2 environments with same properties except application
version. The current version will be called blue and new version will be green. Just
update ingress rules to redirect traffic to green deployment.
#7 Monitoring
Monitor Everything
Prometheus
Prometheus is capable of collecting metrics from known sources like cAdvisor.
Prometheus is mainly used for collecting metrics and alert manager to notify you on
any kind of problem
Prometheus Operator
Hopefully, CoreOS team developed a project called prometheus operator to collect k8s
specific metrics automatically.
https://github.com/coreos/prometheus-operator
Getting Started
You can install Prometheus with Helm charts
Visualization
Prometheus lets us to keep track of external services by using some endpoint via
exporters. To visualize metrics, we will use grafana.
Ultimate Guide to Microservice Architecture on Kubernetes
Alert Manager
#8 Logging
Spring Boot Logging
Logging Types
● Node Level Logging
● Cluster Level Logging
Node Level Logging
Cluster-Level Logging
You can use several technology to send your logs to logging backend. It can be
Graylog, ELK, etc...
logz.io
Kubernetes Setup
You can run a daemonset to send your logs to logz.io as stated here:
https://github.com/DanielBerman/k8s_logging_files/blob/master/logging_logz/daemons
et-logz.yaml
#9 APM & Service Mesh
Why to Monitor Service Metrics?
Beautiful graphs and dashboard fetched from log resources may not be helpful for you
every time when you face a difficult issue. You may need to see your service insights to
find the root cause.
Tools Can Be Used
NewRelic, AppDynamics, DynaTrace, Zipkin can be suggestion for your APM
monitoring. However, in a containerized microservices world, you may need to have a
tool that works in real-time and has some AI capabilities.
Instana
Instana is an AI Powered Application and Infrastructure Monitoring
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
#10 API GATEWAY
Microservice Patterns?
In most cases, we have foundation services to access data, and aggregation layer to
aggregate data to serve specific clients. According to my experience, you can handle
microservice division in two ways. (There are many more, but those two are general)
Aggregation Layer
Service 1
Service 2
Service 3
DB 1
DB 2
DB 3
Cache 1
Cache 1
Cache 1
Aggregation
Service
Load
Balancer
Aggregation Layer
When client wants to get data that contains data from multiple services, it consults to
endpoint on aggregation layer.
GET /users/1
User Response = Data(Service1) + Data(Service2) + Data(Service3)
Proxy Pattern
In this pattern, you can use API Gateway to proxy requests to downstream
microservices. Kong, and Tyk are the more popular options for API Gateway
Service 2
Service 1
Service 3
Service 5
Service 6
Service 4
Service 7
Load Balancer
● Proxy ~3000 req/sec with 65 ms latency
● Proxy ~2000 rew/sec with 85ms latency including key validation, security check,
quota management
● 2-Core 2GB Virtual Server
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
#11 Event Sourcing &
CQRS
CRUD Nature
In services, we always try to change a state of a resource at one time in one transaction.
When more instance needed, we started to use distributed transactions by applying 2-
Phase-Commit protocol in Extended Architecture (a.k.a XA).
Whenever you do a change current state of an entity, old transaction logs gone.
Event Sourcing
Instead of saving current state of entity, save state-changing events belongs to entity in
a time series format
You can replay events within event store, even you can reproduce a bug if exists on
your production!
There is no update to past state of an entity, instead of use an updated event entity in
new row.
Product Events
Product(‘Computer’, 1000 USD)
Product(‘Laptop’, 1000 USD)
Product(‘Laptop’, 900 USD)
ProductMetadataUpdateEvent
ProductPriceUpdateEvent
How?
You can use Apache Kafka, Cassandra, etc … to keep you revents to make them
available to any kind of consumer.
Just save event on any action for example user creation, but you don’t have to return
response immediately.
Event handlers, handle event to populate their views to make available to query
CQRS
Command and Query Responsibility Segregation
A Command alters the state of an object, but does not returns data
A Query returns data, but does not alter state of object
Product Service
Create
Product
Update
Product
Delete
Product
ProductCreateHandler
Topic per Event
Or
Topic per Object and event type in log
Apache Kafka
Database
APIGATEWAY
Create Product Request
Read Product Request
Frameworks
Ultimate Guide to Microservice Architecture on Kubernetes
Thank You
http://bit.ly/huseyinbabal
http://bit.ly/kloia-daas
http://bit.ly/k8s-microservice

More Related Content

PPTX
Kubernates vs Openshift: What is the difference and comparison between Opensh...
PDF
Gitops Hands On
PPTX
Azure DevOps CI/CD For Beginners
PDF
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
PPTX
Azure Bicep - An Introduction
PDF
淺談系統監控與 AWS CloudWatch 的應用
PDF
Introduction to Docker Compose
PPTX
Kubernetes 101 for Beginners
Kubernates vs Openshift: What is the difference and comparison between Opensh...
Gitops Hands On
Azure DevOps CI/CD For Beginners
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
Azure Bicep - An Introduction
淺談系統監控與 AWS CloudWatch 的應用
Introduction to Docker Compose
Kubernetes 101 for Beginners

What's hot (20)

PPTX
Patna MuleSoft Meetup Anypoint Cloudhub 2.0
PPTX
Running Spring Boot in Kubernetes and Intro to Helm
PPTX
Lets talk about: Azure Kubernetes Service (AKS)
PDF
Introduction to docker
PPTX
Containers and Docker
PPTX
Azure AKS
PPT
Docker introduction
PPTX
Docker 101 - Nov 2016
PPTX
Kubernetes Introduction
PPTX
The Power of Azure DevOps
PDF
Kubernetes 101
PDF
Gitops: the kubernetes way
PDF
Docker & kubernetes
PDF
Kubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShift
PPTX
Docker 101 : Introduction to Docker and Containers
PDF
Understanding MicroSERVICE Architecture with Java & Spring Boot
PDF
Microservices with Java, Spring Boot and Spring Cloud
PDF
Introduction to Docker
PDF
CI:CD in Lightspeed with kubernetes and argo cd
PDF
MuleSoft Sizing Guidelines - VirtualMuleys
Patna MuleSoft Meetup Anypoint Cloudhub 2.0
Running Spring Boot in Kubernetes and Intro to Helm
Lets talk about: Azure Kubernetes Service (AKS)
Introduction to docker
Containers and Docker
Azure AKS
Docker introduction
Docker 101 - Nov 2016
Kubernetes Introduction
The Power of Azure DevOps
Kubernetes 101
Gitops: the kubernetes way
Docker & kubernetes
Kubernetes 101 - an Introduction to Containers, Kubernetes, and OpenShift
Docker 101 : Introduction to Docker and Containers
Understanding MicroSERVICE Architecture with Java & Spring Boot
Microservices with Java, Spring Boot and Spring Cloud
Introduction to Docker
CI:CD in Lightspeed with kubernetes and argo cd
MuleSoft Sizing Guidelines - VirtualMuleys
Ad

Similar to Ultimate Guide to Microservice Architecture on Kubernetes (20)

PDF
GCP Meetup #3 - Approaches to Cloud Native Architectures
PPTX
Sumo Logic Cert Jam - Advanced Metrics with Kubernetes
PDF
Slide DevSecOps Microservices
PPTX
CI/CD Pipeline with Kubernetes
PDF
Where should I run my code? Serverless, Containers, Virtual Machines and more
PDF
Azure Day Rome 2019 Reloaded - Strangle(r pattern) your legacy application ru...
PDF
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
PDF
AKS: k8s e azure
PDF
The path to a serverless-native era with Kubernetes
PPTX
Spring Cloud Services with Pivotal Cloud Foundry- Gokhan Goksu
PDF
Red Hat Forum Benelux 2015
PPTX
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
PPTX
Pivotal Container Service Overview
PPTX
Microservices with kubernetes @190316
PDF
Open shift and docker - october,2014
PDF
Introduction to Kubernetes with demo
PDF
SpringBoot and Spring Cloud Service for MSA
PDF
Google Cloud Next '22 Recap: Serverless & Data edition
PDF
Openshift serverless Solution
PDF
Continuous Lifecycle London 2018 Event Keynote
GCP Meetup #3 - Approaches to Cloud Native Architectures
Sumo Logic Cert Jam - Advanced Metrics with Kubernetes
Slide DevSecOps Microservices
CI/CD Pipeline with Kubernetes
Where should I run my code? Serverless, Containers, Virtual Machines and more
Azure Day Rome 2019 Reloaded - Strangle(r pattern) your legacy application ru...
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
AKS: k8s e azure
The path to a serverless-native era with Kubernetes
Spring Cloud Services with Pivotal Cloud Foundry- Gokhan Goksu
Red Hat Forum Benelux 2015
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
Pivotal Container Service Overview
Microservices with kubernetes @190316
Open shift and docker - october,2014
Introduction to Kubernetes with demo
SpringBoot and Spring Cloud Service for MSA
Google Cloud Next '22 Recap: Serverless & Data edition
Openshift serverless Solution
Continuous Lifecycle London 2018 Event Keynote
Ad

More from kloia (20)

PPTX
Converged Infrastructures on Kubernetes with Kubevirt
PPTX
Kloia AWS IBM Hashicorp Day Presentation
PPTX
AWS reInvent recap 2024 - Dorian/Derya SEZEN
PPTX
re:Invent recap - Application Modernization
PDF
Isovalent-kloia Cilium Workshop
PPTX
Kloia - Why Microsoft Modernisation Matters
PDF
DotNetKonf23 - NET Modernization Problems & Solutions.pdf
PPTX
AWS User Group Meetup Feb2023.pptx
PDF
re:Invent Recap
PPTX
The New era in QA: k6
PPTX
Etkili Blog Yazım Teknikleri - Tuğba Sertkaya
PPTX
AWS re:Invent 2021 Recap by APN Ambassador
PPTX
Camunda BPM - Said Mengi
PPTX
AlOps - Yetişkan Eliaçık
PPTX
Zaman Yönetimi - Aras Bilgen
PDF
Gravitee API Management - Ahmet AYDIN
PPTX
React Bootcamp Day 2 - Yunus Demirpolat
PPTX
React Bootcamp Day 1 - Yunus Demirpolat
PDF
Contract testing - Baran Gayretli
PDF
Contract Testing
Converged Infrastructures on Kubernetes with Kubevirt
Kloia AWS IBM Hashicorp Day Presentation
AWS reInvent recap 2024 - Dorian/Derya SEZEN
re:Invent recap - Application Modernization
Isovalent-kloia Cilium Workshop
Kloia - Why Microsoft Modernisation Matters
DotNetKonf23 - NET Modernization Problems & Solutions.pdf
AWS User Group Meetup Feb2023.pptx
re:Invent Recap
The New era in QA: k6
Etkili Blog Yazım Teknikleri - Tuğba Sertkaya
AWS re:Invent 2021 Recap by APN Ambassador
Camunda BPM - Said Mengi
AlOps - Yetişkan Eliaçık
Zaman Yönetimi - Aras Bilgen
Gravitee API Management - Ahmet AYDIN
React Bootcamp Day 2 - Yunus Demirpolat
React Bootcamp Day 1 - Yunus Demirpolat
Contract testing - Baran Gayretli
Contract Testing

Recently uploaded (20)

PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PPTX
Patient Appointment Booking in Odoo with online payment
PPTX
assetexplorer- product-overview - presentation
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
Cost to Outsource Software Development in 2025
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
Microsoft Office 365 Crack Download Free
PPTX
Introduction to Windows Operating System
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PDF
Salesforce Agentforce AI Implementation.pdf
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Autodesk AutoCAD Crack Free Download 2025
Wondershare Recoverit Full Crack New Version (Latest 2025)
Why Generative AI is the Future of Content, Code & Creativity?
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Designing Intelligence for the Shop Floor.pdf
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Patient Appointment Booking in Odoo with online payment
assetexplorer- product-overview - presentation
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
CNN LeNet5 Architecture: Neural Networks
Cost to Outsource Software Development in 2025
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
Microsoft Office 365 Crack Download Free
Introduction to Windows Operating System
Monitoring Stack: Grafana, Loki & Promtail
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
Salesforce Agentforce AI Implementation.pdf
Computer Software and OS of computer science of grade 11.pptx
Autodesk AutoCAD Crack Free Download 2025

Ultimate Guide to Microservice Architecture on Kubernetes