SlideShare uma empresa Scribd logo
1 de 22
Baixar para ler offline
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
info@container-solutions.com
container-solutions.com
Kubernetes
Deployment
Strategies
Etienne Tremel
etienne.tremel@container-solutions.com
@etiennetremel
20.03.2018
Day of Cloud, Oslo
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
What is what?
A
F
C D
E
B
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Kubernetes deployment: in brief
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Kubernetes deployment: complex routing
Ingress controllers:
- Nginx
- Traefik
- Istio
- GKE
- etc.
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Kubernetes deployment: configuration
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Readiness/Liveness probeapiVersion: v1
kind: Pod
metadata:
name: goproxy
labels:
app: goproxy
spec:
containers:
- name: goproxy
image: k8s.gcr.io/goproxy:0.1
ports:
- containerPort: 8080
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
Liveness
Any code greater than or equal to 200 and less
than 400 indicates success. Any other code
indicates failure.
livenessProbe:
httpGet:
path: /healthz
port: liveness-port
HTTP request:
Readiness
livenessProbe:
exec:
command:
- cat
- /tmp/healthy
Shell command:
Exit code return 0: healthy
Exit code return 1: unhealthy
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Getting started
1. git clone -b gke
https://github.com/ContainerSolutions/k8s-deployment-strategies
2. Play around with the different strategies
■ Recreate
■ Ramped
■ Blue/Green
■ Canary
■ A/B Testing
■ Shadow
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
[...]
kind: Deployment
spec:
replicas: 3
strategy:
type: Recreate
[...]
$ kubectl apply -f ./manifest.yaml
Recreate
Version A is terminated then version B is rolled out
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Recreate
Version A is terminated then version B is rolled out
Pros:
- easy to setup
Cons:
- high impact on the user, expect downtime that depends on both shutdown and
boot duration of the application
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Ramped (aka incremental, rolling update)
Version B is slowly rolled out and replacing version A
[...]
kind: Deployment
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 2 # how many pods we can add at a time
maxUnavailable: 0 # maxUnavailable define how many pods can be
# unavailable during the rolling update
[...]
$ kubectl apply -f ./manifest.yaml
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Ramped (aka incremental, rolling update)
Version B is slowly rolled out and replacing version A
Pros:
- easy to use
- version is slowly released across instances
- convenient for stateful applications that can handle ongoing rebalancing of the
data
Cons:
- rollout/rollback can take time
- no control over traffic
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Blue/Green (aka Red/Black)
Version B is released alongside version A, then the traffic is switched to version B
[...]
kind: Service
spec:
# Note here that we match both the app and the version.
# When switching traffic, update the label “version” with
# the appropriate value, ie: v2.0.0
selector:
app: my-app
version: v1.0.0
[...] $ kubectl apply -f ./manifest-v2.yaml
$ kubectl patch service my-app -p 
'{"spec":{"selector":{"version":"v2.0.0"}}}'
$ kubectl delete -f ./manifest-v1.yaml
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Blue/Green (aka Red/Black)
Version B is released alongside version A, then the traffic is switched to version B
Pros:
- instant rollout/rollback
- good fit for front-end that load versioned assets from the same server
- dirty way to fix application dependency hell
Cons:
- expensive as it requires double the resources
- proper test of the entire platform should be done before releasing to production
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Canary
Version B is released to a subset of users, then proceed to a full rollout
[...]
kind: Deployment
metadata:
name: my-app-v1
spec:
replicas: 9
template:
labels:
app: my-app
version: v1.0.0
[...]
[...]
kind: Service
metadata:
name: my-app
spec:
selector:
app: my-app
[...]
[...]
kind: Deployment
metadata:
name: my-app-v2
spec:
replicas: 1
template:
labels:
app: my-app
version: v2.0.0
[...]
$ kubectl apply -f ./manifest-v2.yaml
$ kubectl scale deploy/my-app-v2 --replicas=10
$ kubectl delete -f ./manifest-v1.yaml
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Canary
Version B is released to a subset of users, then proceed to a full rollout
Pros:
- version released for a subset of users
- convenient for error rate and performance monitoring
- fast rollback
Cons:
- slow rollout
- sticky sessions might be required
- precise traffic shifting would require additional tool like Istio or Linkerd
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
A/B Testing
Version B is released to a subset of users under specific condition
[...]
kind: RouteRule
metadata:
name: my-app-v1
spec:
destination:
name: my-app
route:
- labels:
version: v1.0.0
match:
request:
headers:
x-api-version:
exact: "v1.0.0"
[...]
[...]
kind: RouteRule
metadata:
name: my-app-v2
spec:
destination:
name: my-app
route:
- labels:
version: v2.0.0
match:
request:
headers:
x-api-version:
exact: "v2.0.0"
[...]
$ kubectl apply -f
./manifest-v2.yaml
$ kubectl apply -f ./routerule.yaml
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
A/B Testing
Version B is released to a subset of users under specific condition
Pros:
- several versions run in parallel
- full control over the traffic distribution
- great tool that can be used for business purpose to improve conversion
Cons:
- requires intelligent load balancer (Istio, Linkerd, etc.)
- hard to troubleshoot errors for a given session, distributed tracing becomes
mandatory
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Shadow(aka mirrored)
Version B receives real-world traffic alongside version A and doesn’t impact the response.
[...]
kind: RouteRule
spec:
destination:
name: my-app
route:
- labels:
version: v1.0.0
weight: 100
- labels:
version: v2.0.0
weight: 0
mirror:
name: my-app-v2
labels:
version: v2.0.0
[...]
$ kubectl apply -f
./manifest-v2.yaml
$ kubectl apply -f ./routerule.yaml
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Shadow(aka mirrored)
Version B receives real-world traffic alongside version A and doesn’t impact the response.
Pros:
- performance testing of the application with production traffic
- no impact on the user
- no rollout until the stability and performance of the application meet the
requirements
Cons:
- complex to setup
- expensive as it requires double the resources
- not a true user test and can be misleading
- requires mocking/stubbing service for certain cases
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Sum up
■ recreate if downtime is not a problem
■ recreate and ramped doesn’t require any extra step (kubectl apply is enough)
■ ramped and blue/green deployment are usually a good fit and easy to use
■ blue/green is a good fit for front-end that load versioned assets from the same server
■ blue/green and shadow can be expensive
■ canary and a/b testing should be used if little confidence on the quality of the release
■ canary, a/b testing and shadow might require additional cluster component
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
Decision
diagram
container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel
info@container-solutions.com
container-solutions.com
Thanks!
Etienne Tremel
etienne.tremel@container-solutions.com
@etiennetremel
Hands on Kubernetes deployment strategies:
github.com/ContainerSolutions/k8s-deployment-strategies
Blog post about strategies:
container-solutions.com/kubernetes-deployment-strategies
thenewstack.io/deployment-strategies
Next

Mais conteúdo relacionado

Último

why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 

Último (20)

why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 

Destaque

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 

Destaque (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

Kubernetes Deployment Strategies Workshop - Day Of Cloud - 20.03.2018

  • 1. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel info@container-solutions.com container-solutions.com Kubernetes Deployment Strategies Etienne Tremel etienne.tremel@container-solutions.com @etiennetremel 20.03.2018 Day of Cloud, Oslo
  • 2. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel What is what? A F C D E B
  • 3. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Kubernetes deployment: in brief
  • 4. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Kubernetes deployment: complex routing Ingress controllers: - Nginx - Traefik - Istio - GKE - etc.
  • 5. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Kubernetes deployment: configuration
  • 6. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Readiness/Liveness probeapiVersion: v1 kind: Pod metadata: name: goproxy labels: app: goproxy spec: containers: - name: goproxy image: k8s.gcr.io/goproxy:0.1 ports: - containerPort: 8080 readinessProbe: tcpSocket: port: 8080 initialDelaySeconds: 5 periodSeconds: 10 livenessProbe: tcpSocket: port: 8080 initialDelaySeconds: 15 periodSeconds: 20 Liveness Any code greater than or equal to 200 and less than 400 indicates success. Any other code indicates failure. livenessProbe: httpGet: path: /healthz port: liveness-port HTTP request: Readiness livenessProbe: exec: command: - cat - /tmp/healthy Shell command: Exit code return 0: healthy Exit code return 1: unhealthy
  • 7. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Getting started 1. git clone -b gke https://github.com/ContainerSolutions/k8s-deployment-strategies 2. Play around with the different strategies ■ Recreate ■ Ramped ■ Blue/Green ■ Canary ■ A/B Testing ■ Shadow
  • 8. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel [...] kind: Deployment spec: replicas: 3 strategy: type: Recreate [...] $ kubectl apply -f ./manifest.yaml Recreate Version A is terminated then version B is rolled out
  • 9. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Recreate Version A is terminated then version B is rolled out Pros: - easy to setup Cons: - high impact on the user, expect downtime that depends on both shutdown and boot duration of the application
  • 10. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Ramped (aka incremental, rolling update) Version B is slowly rolled out and replacing version A [...] kind: Deployment spec: replicas: 3 strategy: type: RollingUpdate rollingUpdate: maxSurge: 2 # how many pods we can add at a time maxUnavailable: 0 # maxUnavailable define how many pods can be # unavailable during the rolling update [...] $ kubectl apply -f ./manifest.yaml
  • 11. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Ramped (aka incremental, rolling update) Version B is slowly rolled out and replacing version A Pros: - easy to use - version is slowly released across instances - convenient for stateful applications that can handle ongoing rebalancing of the data Cons: - rollout/rollback can take time - no control over traffic
  • 12. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Blue/Green (aka Red/Black) Version B is released alongside version A, then the traffic is switched to version B [...] kind: Service spec: # Note here that we match both the app and the version. # When switching traffic, update the label “version” with # the appropriate value, ie: v2.0.0 selector: app: my-app version: v1.0.0 [...] $ kubectl apply -f ./manifest-v2.yaml $ kubectl patch service my-app -p '{"spec":{"selector":{"version":"v2.0.0"}}}' $ kubectl delete -f ./manifest-v1.yaml
  • 13. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Blue/Green (aka Red/Black) Version B is released alongside version A, then the traffic is switched to version B Pros: - instant rollout/rollback - good fit for front-end that load versioned assets from the same server - dirty way to fix application dependency hell Cons: - expensive as it requires double the resources - proper test of the entire platform should be done before releasing to production
  • 14. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Canary Version B is released to a subset of users, then proceed to a full rollout [...] kind: Deployment metadata: name: my-app-v1 spec: replicas: 9 template: labels: app: my-app version: v1.0.0 [...] [...] kind: Service metadata: name: my-app spec: selector: app: my-app [...] [...] kind: Deployment metadata: name: my-app-v2 spec: replicas: 1 template: labels: app: my-app version: v2.0.0 [...] $ kubectl apply -f ./manifest-v2.yaml $ kubectl scale deploy/my-app-v2 --replicas=10 $ kubectl delete -f ./manifest-v1.yaml
  • 15. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Canary Version B is released to a subset of users, then proceed to a full rollout Pros: - version released for a subset of users - convenient for error rate and performance monitoring - fast rollback Cons: - slow rollout - sticky sessions might be required - precise traffic shifting would require additional tool like Istio or Linkerd
  • 16. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel A/B Testing Version B is released to a subset of users under specific condition [...] kind: RouteRule metadata: name: my-app-v1 spec: destination: name: my-app route: - labels: version: v1.0.0 match: request: headers: x-api-version: exact: "v1.0.0" [...] [...] kind: RouteRule metadata: name: my-app-v2 spec: destination: name: my-app route: - labels: version: v2.0.0 match: request: headers: x-api-version: exact: "v2.0.0" [...] $ kubectl apply -f ./manifest-v2.yaml $ kubectl apply -f ./routerule.yaml
  • 17. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel A/B Testing Version B is released to a subset of users under specific condition Pros: - several versions run in parallel - full control over the traffic distribution - great tool that can be used for business purpose to improve conversion Cons: - requires intelligent load balancer (Istio, Linkerd, etc.) - hard to troubleshoot errors for a given session, distributed tracing becomes mandatory
  • 18. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Shadow(aka mirrored) Version B receives real-world traffic alongside version A and doesn’t impact the response. [...] kind: RouteRule spec: destination: name: my-app route: - labels: version: v1.0.0 weight: 100 - labels: version: v2.0.0 weight: 0 mirror: name: my-app-v2 labels: version: v2.0.0 [...] $ kubectl apply -f ./manifest-v2.yaml $ kubectl apply -f ./routerule.yaml
  • 19. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Shadow(aka mirrored) Version B receives real-world traffic alongside version A and doesn’t impact the response. Pros: - performance testing of the application with production traffic - no impact on the user - no rollout until the stability and performance of the application meet the requirements Cons: - complex to setup - expensive as it requires double the resources - not a true user test and can be misleading - requires mocking/stubbing service for certain cases
  • 20. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Sum up ■ recreate if downtime is not a problem ■ recreate and ramped doesn’t require any extra step (kubectl apply is enough) ■ ramped and blue/green deployment are usually a good fit and easy to use ■ blue/green is a good fit for front-end that load versioned assets from the same server ■ blue/green and shadow can be expensive ■ canary and a/b testing should be used if little confidence on the quality of the release ■ canary, a/b testing and shadow might require additional cluster component
  • 21. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel Decision diagram
  • 22. container-solutions.com etienne.tremel@container-solutions.com Kubernetes Deployment Strategies @etiennetremel info@container-solutions.com container-solutions.com Thanks! Etienne Tremel etienne.tremel@container-solutions.com @etiennetremel Hands on Kubernetes deployment strategies: github.com/ContainerSolutions/k8s-deployment-strategies Blog post about strategies: container-solutions.com/kubernetes-deployment-strategies thenewstack.io/deployment-strategies Next