SlideShare a Scribd company logo
1 of 24
ZERO-DOWNTIME DEPLOYMENT
on K8S
the missing part
Bảo Huỳnh
Site Reliability Engineering
12-Jun-2020
AGENDA
1. Deployment & Replicas: are we really safe ?
2. Understand Pod Eviction Lifecycle
3. Avoid Outages
4. Beyond the Outages
1. Deployment & Replicas: really safe ?
We have:
● Replicas : 2
● RollingUpdate Strategy
● maxUnavailable: 1
* Everything seems quite strong to avoid downtime
* What happens if one pod disappear ?
* How about existing & upcoming traffic ?
1. Deployment & Replicas: really safe ?
Downtime will occur IF:
- Existing traffic does not being handled properly
- Application does not handle graceful shutdown
- ……….
2. Understand Pod Eviction Lifecycle
● kubectl delete / drain / upgrade
● A request 🡪 nodes where pod is located
● kubelet sends SIGTERM to pods
● kubelet sends SIGKILL after graceful period (preStop + time stopping app)
Add preStop hook to graceful
shutdown nginx
🡪 Make sure app finish handling
existing connections before quit
2. Understand Pod Eviction Lifecycle
2. Understand Pod Eviction Lifecycle
- Drain “node 1”
- Sent SIGTERM to nginx pod
- preStop hook is executed
(nginx quit)
2. Understand Pod Eviction Lifecycle
+ New request is coming
+ Being routed to stopping Nginx
+ Error….
2. Understand Pod Eviction Lifecycle
2. Understand Pod Eviction Lifecycle
- Why does this sh*t happens ?
- Why does stupid K8S still routing traffic to a “terminating” pod ?
- said CT Engineer -
3. Avoid the Outages
Recall pod shutdown sequence
● kubectl delete / drain / upgrade
● A request 🡪 nodes where pod is located
● kubelet sends SIGTERM to pods
● kubelet sends SIGKILL after graceful period (preStop + time to stop app)
……………………….
RIGHT, but NOT ENOUGH
3. Avoid the Outages
Figure 1: Sequences occur when pod is deleted
3. Avoid the Outages
Figure 2: Timeline “version” for pod deletion’s events
- Two flows run in parellel
- No guarantee [A] finish after [B]
3. Avoid the Outages
3. Avoid the Outages
BUT HOW ???
3. Avoid the Outages
● don’t work, just SLEEP
● … & wait for deregister flow (B) to complete
before graceful shutdown
3. Avoid the Outages
3. Avoid the Outages
3. Avoid the Outages
4. Beyond the Outages
- Introducing: PodDisruptionBudgets
- An indicator of the number of disruptions that
can be tolerated at a given time for a class of
pods (a budget of faults).
- If number of pod < PodDisruptionBudgets, the
drain operation is halted
(wait for new pod come up & increase above the
threshold)
4. Beyond the Outages
Summary
Application:
- Handed SIGTERM for graceful shutdown
System:
- Apply preStop lifecycle
- Apply Sleep to make sure pod Endpoint is deregistered from Service to
avoid new coming traffic
- Using PodDisruptionBudgets to avoid all pods down at the same time
Questions & Answers
Appendix: Service Disruption
Involuntary disruptions Voluntary disruptions
HW failure,
node disappear from cluster
deployment upgrade,
delete pod
node upgrade
node drain

More Related Content

What's hot

Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow IntroductionDavid Paluy
 
Git Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and TagsGit Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and TagsMikhail Melnik
 
Git Flow - An Introduction
Git Flow - An IntroductionGit Flow - An Introduction
Git Flow - An IntroductionKnoldus Inc.
 
Continious integration pipeline
Continious integration pipelineContinious integration pipeline
Continious integration pipelineGomathiNayagam S
 
Kubernetes-native or not? When should you ditch your traditional CI/CD server...
Kubernetes-native or not? When should you ditch your traditional CI/CD server...Kubernetes-native or not? When should you ditch your traditional CI/CD server...
Kubernetes-native or not? When should you ditch your traditional CI/CD server...Red Hat Developers
 
Git tutorial git branches 20131206-Bryan
Git tutorial   git branches 20131206-BryanGit tutorial   git branches 20131206-Bryan
Git tutorial git branches 20131206-BryanLearningTech
 
Kubernetes configuration and security policies with KubeLinter | DevNation Te...
Kubernetes configuration and security policies with KubeLinter | DevNation Te...Kubernetes configuration and security policies with KubeLinter | DevNation Te...
Kubernetes configuration and security policies with KubeLinter | DevNation Te...Red Hat Developers
 
Top 10 Kubernetes Native Java Quarkus Features
Top 10 Kubernetes Native Java Quarkus FeaturesTop 10 Kubernetes Native Java Quarkus Features
Top 10 Kubernetes Native Java Quarkus Featuresjclingan
 
Quarkus: From developer joy to Kubernetes nirvana! | DevNation Tech Talk
Quarkus: From developer joy to Kubernetes nirvana! | DevNation Tech TalkQuarkus: From developer joy to Kubernetes nirvana! | DevNation Tech Talk
Quarkus: From developer joy to Kubernetes nirvana! | DevNation Tech TalkRed Hat Developers
 
Why Aren't You Using Git Flow?
Why Aren't You Using Git Flow?Why Aren't You Using Git Flow?
Why Aren't You Using Git Flow?John Congdon
 
Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentationMack Hardy
 
GitLab 라이선스별 특징 요약 - 인포그랩
GitLab 라이선스별 특징 요약 - 인포그랩GitLab 라이선스별 특징 요약 - 인포그랩
GitLab 라이선스별 특징 요약 - 인포그랩InfoGrab LC
 
Crossing the Streams! Rollout Strategies to Keep Your Users Happy!
Crossing the Streams! Rollout Strategies to Keep Your Users Happy!Crossing the Streams! Rollout Strategies to Keep Your Users Happy!
Crossing the Streams! Rollout Strategies to Keep Your Users Happy!VMware Tanzu
 

What's hot (20)

Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
 
Git Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and TagsGit Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and Tags
 
Git Flow - An Introduction
Git Flow - An IntroductionGit Flow - An Introduction
Git Flow - An Introduction
 
Continious integration pipeline
Continious integration pipelineContinious integration pipeline
Continious integration pipeline
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
 
Git flow
Git flowGit flow
Git flow
 
Kubernetes-native or not? When should you ditch your traditional CI/CD server...
Kubernetes-native or not? When should you ditch your traditional CI/CD server...Kubernetes-native or not? When should you ditch your traditional CI/CD server...
Kubernetes-native or not? When should you ditch your traditional CI/CD server...
 
Git tutorial git branches 20131206-Bryan
Git tutorial   git branches 20131206-BryanGit tutorial   git branches 20131206-Bryan
Git tutorial git branches 20131206-Bryan
 
Kubernetes configuration and security policies with KubeLinter | DevNation Te...
Kubernetes configuration and security policies with KubeLinter | DevNation Te...Kubernetes configuration and security policies with KubeLinter | DevNation Te...
Kubernetes configuration and security policies with KubeLinter | DevNation Te...
 
Git Tricks
Git TricksGit Tricks
Git Tricks
 
Top 10 Kubernetes Native Java Quarkus Features
Top 10 Kubernetes Native Java Quarkus FeaturesTop 10 Kubernetes Native Java Quarkus Features
Top 10 Kubernetes Native Java Quarkus Features
 
Quarkus: From developer joy to Kubernetes nirvana! | DevNation Tech Talk
Quarkus: From developer joy to Kubernetes nirvana! | DevNation Tech TalkQuarkus: From developer joy to Kubernetes nirvana! | DevNation Tech Talk
Quarkus: From developer joy to Kubernetes nirvana! | DevNation Tech Talk
 
Neutron upgrades
Neutron upgradesNeutron upgrades
Neutron upgrades
 
Why Aren't You Using Git Flow?
Why Aren't You Using Git Flow?Why Aren't You Using Git Flow?
Why Aren't You Using Git Flow?
 
Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentation
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
git-flow R3Labs
git-flow R3Labsgit-flow R3Labs
git-flow R3Labs
 
GitLab 라이선스별 특징 요약 - 인포그랩
GitLab 라이선스별 특징 요약 - 인포그랩GitLab 라이선스별 특징 요약 - 인포그랩
GitLab 라이선스별 특징 요약 - 인포그랩
 
Crossing the Streams! Rollout Strategies to Keep Your Users Happy!
Crossing the Streams! Rollout Strategies to Keep Your Users Happy!Crossing the Streams! Rollout Strategies to Keep Your Users Happy!
Crossing the Streams! Rollout Strategies to Keep Your Users Happy!
 

Similar to K8s-zero-downtime-the-missing-part

Production Grade Kubernetes Applications
Production Grade Kubernetes ApplicationsProduction Grade Kubernetes Applications
Production Grade Kubernetes ApplicationsNarayanan Krishnamurthy
 
Upgrade Kubernetes the boring way
Upgrade Kubernetes the boring wayUpgrade Kubernetes the boring way
Upgrade Kubernetes the boring wayOleksandr Slynko
 
Why I love Kubernetes Failure Stories and you should too - GOTO Berlin
Why I love Kubernetes Failure Stories and you should too - GOTO BerlinWhy I love Kubernetes Failure Stories and you should too - GOTO Berlin
Why I love Kubernetes Failure Stories and you should too - GOTO BerlinHenning Jacobs
 
Kubernetes Failure Stories, or: How to Crash Your Cluster - ContainerDays EU ...
Kubernetes Failure Stories, or: How to Crash Your Cluster - ContainerDays EU ...Kubernetes Failure Stories, or: How to Crash Your Cluster - ContainerDays EU ...
Kubernetes Failure Stories, or: How to Crash Your Cluster - ContainerDays EU ...Henning Jacobs
 
Lessons Learned from Migrating Legacy Enterprise Applications to Microservices
Lessons Learned from Migrating Legacy Enterprise Applications to MicroservicesLessons Learned from Migrating Legacy Enterprise Applications to Microservices
Lessons Learned from Migrating Legacy Enterprise Applications to MicroservicesVMware Tanzu
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in AndroidOpersys inc.
 
Running Kubernetes in Production: A Million Ways to Crash Your Cluster - Cont...
Running Kubernetes in Production: A Million Ways to Crash Your Cluster - Cont...Running Kubernetes in Production: A Million Ways to Crash Your Cluster - Cont...
Running Kubernetes in Production: A Million Ways to Crash Your Cluster - Cont...Henning Jacobs
 
Velocity 2012 - Learning WebOps the Hard Way
Velocity 2012 - Learning WebOps the Hard WayVelocity 2012 - Learning WebOps the Hard Way
Velocity 2012 - Learning WebOps the Hard WayCosimo Streppone
 
2017 Microservices Practitioner Virtual Summit: Microservices at Squarespace ...
2017 Microservices Practitioner Virtual Summit: Microservices at Squarespace ...2017 Microservices Practitioner Virtual Summit: Microservices at Squarespace ...
2017 Microservices Practitioner Virtual Summit: Microservices at Squarespace ...Ambassador Labs
 
Introduce to Git and Jenkins
Introduce to Git and JenkinsIntroduce to Git and Jenkins
Introduce to Git and JenkinsAn Nguyen
 
TechTalk5-WhatDoesItTakeToRunLLVMBuildbots.pdf
TechTalk5-WhatDoesItTakeToRunLLVMBuildbots.pdfTechTalk5-WhatDoesItTakeToRunLLVMBuildbots.pdf
TechTalk5-WhatDoesItTakeToRunLLVMBuildbots.pdfxiso
 
GitOps and security by Reto Bollinger, CSIO nine.ch
GitOps and security by Reto Bollinger, CSIO nine.chGitOps and security by Reto Bollinger, CSIO nine.ch
GitOps and security by Reto Bollinger, CSIO nine.chnine
 
Awe k2 midterms finals
Awe k2 midterms finalsAwe k2 midterms finals
Awe k2 midterms finalsKaren Tay
 
Cloud orchestration risks
Cloud orchestration risksCloud orchestration risks
Cloud orchestration risksGlib Pakharenko
 
Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...
Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...
Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...Anne Nicolas
 
CloudStack UI
CloudStack UICloudStack UI
CloudStack UIShapeBlue
 
Bitworks CloudStack UI - CSEUUG 08 August 2017
Bitworks CloudStack UI - CSEUUG 08 August 2017Bitworks CloudStack UI - CSEUUG 08 August 2017
Bitworks CloudStack UI - CSEUUG 08 August 2017Ivan Kudryavtsev
 

Similar to K8s-zero-downtime-the-missing-part (20)

Production Grade Kubernetes Applications
Production Grade Kubernetes ApplicationsProduction Grade Kubernetes Applications
Production Grade Kubernetes Applications
 
Upgrade Kubernetes the boring way
Upgrade Kubernetes the boring wayUpgrade Kubernetes the boring way
Upgrade Kubernetes the boring way
 
F33 book-depend-pres-pt6
F33 book-depend-pres-pt6F33 book-depend-pres-pt6
F33 book-depend-pres-pt6
 
Why I love Kubernetes Failure Stories and you should too - GOTO Berlin
Why I love Kubernetes Failure Stories and you should too - GOTO BerlinWhy I love Kubernetes Failure Stories and you should too - GOTO Berlin
Why I love Kubernetes Failure Stories and you should too - GOTO Berlin
 
Kubernetes Failure Stories, or: How to Crash Your Cluster - ContainerDays EU ...
Kubernetes Failure Stories, or: How to Crash Your Cluster - ContainerDays EU ...Kubernetes Failure Stories, or: How to Crash Your Cluster - ContainerDays EU ...
Kubernetes Failure Stories, or: How to Crash Your Cluster - ContainerDays EU ...
 
Rac 12c optimization
Rac 12c optimizationRac 12c optimization
Rac 12c optimization
 
Monitoring klassisch oder Cloud
Monitoring klassisch oder CloudMonitoring klassisch oder Cloud
Monitoring klassisch oder Cloud
 
Lessons Learned from Migrating Legacy Enterprise Applications to Microservices
Lessons Learned from Migrating Legacy Enterprise Applications to MicroservicesLessons Learned from Migrating Legacy Enterprise Applications to Microservices
Lessons Learned from Migrating Legacy Enterprise Applications to Microservices
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in Android
 
Running Kubernetes in Production: A Million Ways to Crash Your Cluster - Cont...
Running Kubernetes in Production: A Million Ways to Crash Your Cluster - Cont...Running Kubernetes in Production: A Million Ways to Crash Your Cluster - Cont...
Running Kubernetes in Production: A Million Ways to Crash Your Cluster - Cont...
 
Velocity 2012 - Learning WebOps the Hard Way
Velocity 2012 - Learning WebOps the Hard WayVelocity 2012 - Learning WebOps the Hard Way
Velocity 2012 - Learning WebOps the Hard Way
 
2017 Microservices Practitioner Virtual Summit: Microservices at Squarespace ...
2017 Microservices Practitioner Virtual Summit: Microservices at Squarespace ...2017 Microservices Practitioner Virtual Summit: Microservices at Squarespace ...
2017 Microservices Practitioner Virtual Summit: Microservices at Squarespace ...
 
Introduce to Git and Jenkins
Introduce to Git and JenkinsIntroduce to Git and Jenkins
Introduce to Git and Jenkins
 
TechTalk5-WhatDoesItTakeToRunLLVMBuildbots.pdf
TechTalk5-WhatDoesItTakeToRunLLVMBuildbots.pdfTechTalk5-WhatDoesItTakeToRunLLVMBuildbots.pdf
TechTalk5-WhatDoesItTakeToRunLLVMBuildbots.pdf
 
GitOps and security by Reto Bollinger, CSIO nine.ch
GitOps and security by Reto Bollinger, CSIO nine.chGitOps and security by Reto Bollinger, CSIO nine.ch
GitOps and security by Reto Bollinger, CSIO nine.ch
 
Awe k2 midterms finals
Awe k2 midterms finalsAwe k2 midterms finals
Awe k2 midterms finals
 
Cloud orchestration risks
Cloud orchestration risksCloud orchestration risks
Cloud orchestration risks
 
Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...
Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...
Kernel Recipes 2018 - Live (Kernel) Patching: status quo and status futurus -...
 
CloudStack UI
CloudStack UICloudStack UI
CloudStack UI
 
Bitworks CloudStack UI - CSEUUG 08 August 2017
Bitworks CloudStack UI - CSEUUG 08 August 2017Bitworks CloudStack UI - CSEUUG 08 August 2017
Bitworks CloudStack UI - CSEUUG 08 August 2017
 

More from Huynh Thai Bao

Service Mesh 101 - Digging into your service
Service Mesh 101 - Digging into your service Service Mesh 101 - Digging into your service
Service Mesh 101 - Digging into your service Huynh Thai Bao
 
Cassandra - decentralized structured database
Cassandra - decentralized structured databaseCassandra - decentralized structured database
Cassandra - decentralized structured databaseHuynh Thai Bao
 
Skaffold - faster development on K8S
Skaffold - faster development on K8SSkaffold - faster development on K8S
Skaffold - faster development on K8SHuynh Thai Bao
 
Kubernetes - A Rising Hero
Kubernetes - A Rising HeroKubernetes - A Rising Hero
Kubernetes - A Rising HeroHuynh Thai Bao
 
Vault - Enhancement for K8S secret security
Vault - Enhancement for K8S secret securityVault - Enhancement for K8S secret security
Vault - Enhancement for K8S secret securityHuynh Thai Bao
 
GCP Best Practices for SRE Team
GCP Best Practices for SRE TeamGCP Best Practices for SRE Team
GCP Best Practices for SRE TeamHuynh Thai Bao
 

More from Huynh Thai Bao (7)

Service Mesh 101 - Digging into your service
Service Mesh 101 - Digging into your service Service Mesh 101 - Digging into your service
Service Mesh 101 - Digging into your service
 
K8s Webhook Admission
K8s Webhook AdmissionK8s Webhook Admission
K8s Webhook Admission
 
Cassandra - decentralized structured database
Cassandra - decentralized structured databaseCassandra - decentralized structured database
Cassandra - decentralized structured database
 
Skaffold - faster development on K8S
Skaffold - faster development on K8SSkaffold - faster development on K8S
Skaffold - faster development on K8S
 
Kubernetes - A Rising Hero
Kubernetes - A Rising HeroKubernetes - A Rising Hero
Kubernetes - A Rising Hero
 
Vault - Enhancement for K8S secret security
Vault - Enhancement for K8S secret securityVault - Enhancement for K8S secret security
Vault - Enhancement for K8S secret security
 
GCP Best Practices for SRE Team
GCP Best Practices for SRE TeamGCP Best Practices for SRE Team
GCP Best Practices for SRE Team
 

Recently uploaded

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...Health
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projectssmsksolar
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxnuruddin69
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksMagic Marks
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...HenryBriggs2
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 

Recently uploaded (20)

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 

K8s-zero-downtime-the-missing-part

  • 1. ZERO-DOWNTIME DEPLOYMENT on K8S the missing part Bảo Huỳnh Site Reliability Engineering 12-Jun-2020
  • 2. AGENDA 1. Deployment & Replicas: are we really safe ? 2. Understand Pod Eviction Lifecycle 3. Avoid Outages 4. Beyond the Outages
  • 3. 1. Deployment & Replicas: really safe ? We have: ● Replicas : 2 ● RollingUpdate Strategy ● maxUnavailable: 1 * Everything seems quite strong to avoid downtime * What happens if one pod disappear ? * How about existing & upcoming traffic ?
  • 4. 1. Deployment & Replicas: really safe ? Downtime will occur IF: - Existing traffic does not being handled properly - Application does not handle graceful shutdown - ……….
  • 5. 2. Understand Pod Eviction Lifecycle ● kubectl delete / drain / upgrade ● A request 🡪 nodes where pod is located ● kubelet sends SIGTERM to pods ● kubelet sends SIGKILL after graceful period (preStop + time stopping app)
  • 6. Add preStop hook to graceful shutdown nginx 🡪 Make sure app finish handling existing connections before quit 2. Understand Pod Eviction Lifecycle
  • 7. 2. Understand Pod Eviction Lifecycle - Drain “node 1” - Sent SIGTERM to nginx pod - preStop hook is executed (nginx quit)
  • 8. 2. Understand Pod Eviction Lifecycle + New request is coming + Being routed to stopping Nginx + Error….
  • 9. 2. Understand Pod Eviction Lifecycle
  • 10. 2. Understand Pod Eviction Lifecycle - Why does this sh*t happens ? - Why does stupid K8S still routing traffic to a “terminating” pod ? - said CT Engineer -
  • 11. 3. Avoid the Outages Recall pod shutdown sequence ● kubectl delete / drain / upgrade ● A request 🡪 nodes where pod is located ● kubelet sends SIGTERM to pods ● kubelet sends SIGKILL after graceful period (preStop + time to stop app) ………………………. RIGHT, but NOT ENOUGH
  • 12. 3. Avoid the Outages Figure 1: Sequences occur when pod is deleted
  • 13. 3. Avoid the Outages Figure 2: Timeline “version” for pod deletion’s events - Two flows run in parellel - No guarantee [A] finish after [B]
  • 14. 3. Avoid the Outages
  • 15. 3. Avoid the Outages BUT HOW ???
  • 16. 3. Avoid the Outages ● don’t work, just SLEEP ● … & wait for deregister flow (B) to complete before graceful shutdown
  • 17. 3. Avoid the Outages
  • 18. 3. Avoid the Outages
  • 19. 3. Avoid the Outages
  • 20. 4. Beyond the Outages - Introducing: PodDisruptionBudgets - An indicator of the number of disruptions that can be tolerated at a given time for a class of pods (a budget of faults). - If number of pod < PodDisruptionBudgets, the drain operation is halted (wait for new pod come up & increase above the threshold)
  • 21. 4. Beyond the Outages
  • 22. Summary Application: - Handed SIGTERM for graceful shutdown System: - Apply preStop lifecycle - Apply Sleep to make sure pod Endpoint is deregistered from Service to avoid new coming traffic - Using PodDisruptionBudgets to avoid all pods down at the same time
  • 24. Appendix: Service Disruption Involuntary disruptions Voluntary disruptions HW failure, node disappear from cluster deployment upgrade, delete pod node upgrade node drain