zekeLabs
Learning made Simpler !
www.zekeLabs.com
Please find webinar recordings on www.edYoda.com
Design Patterns for Pods and Containers
on
Kubernetes
info@zekeLabs.com | www.zekeLabs.com | +91 7032051637
● Knowledge about Docker containers
● Basic knowledge of Kubernetes
● Basic knowledge of Microservices
Our previous webinars:
Introduction to Docker https://www.edyoda.com/course/1414?episode_id=728
Microservices using Kubernetes https://www.edyoda.com/course/1414?episode_id=2433
Prerequisites
● Single-Pod Multi-Container Application Pattern
● Multi-Pod Application Pattern
● Kubernetes provided features:
○ InitContainer
○ LifeCyclehook: PostStart
○ LifeCyclehook: PreStop
Agenda
● Bounded Context
● Reusable Docker images
● Scalable at the Pod level
● App image shall have only the core logic
● Immutable Docker images
Design Goals of Pods and Containers
● Sidecar Pattern
● Ambassador/Proxy Pattern
● Adapter Pattern
Single-Pod Multi-Container Application Pattern
1. Sidecar pattern
Application Pod
Main Application
Container
Volume
Sidecar
Container
1. Sidecar pattern
Application Pod
Web Server
Container
/var/log
Log Rotating
Container
● Log Rotator
● Maintenance applications
● Content update
● Tightly coupled functionalities
Use cases of Sidecar Pattern
2. Ambassador pattern
Service 1
Service 2
Service 3
Application Pod
Application
Container
Proxy Ambassador
Container
● Network Proxies
● Service Mesh
● Automatic Retries and Fault tolerant application
● Client-side service discovery
Use cases of Ambassador Pattern
3. Adapter pattern
Application Pod
Application
Container
Adapter
Container
Centralized
Monitoring System
● Monitoring tools such as Prometheus
● Translator Containers
● To make applications platform-agnostic
Use cases of Adapter Pattern
● Leader-follower Pattern
● Scatter-gather Pattern
● Worker-Queue Pattern
Multi-Pod Application Pattern
1. Leader-Follower pattern
Follower
Pod
Leader-
election
Container
Application
Container
Leader
Pod
Leader-
election
Container
Application
Container
Follower
Pod
Leader-
election
Container
Application
Container
1. Usecases of Leader-Follower pattern
● Cluster-aware applications
● Cassandra
● etcd–clusters
● API-server in multi-master node clusters
2. Work-Queue Pattern
Application Pod
Work
Execution
Framework
Container
Application
Container
Application Pod
Work
Execution
Framework
Container
Application
Container
Work Queue
Coordinator
Work Queue
User Work
Request
2. Usecases of Work-queue pattern
● Data Processing Pipelines
● Asynchronous Parallel Batch Jobs
● Work-flow management
Pod
3. Scatter-Gather Pattern
Pod
Developer
Supplied
Container
Framework
Supplied
Container
User Work
Request
Pod
Developer
Supplied
Container
Pod
Developer
Supplied
Container
SubQuery ()
SubQuery ()
MergeResponses()
3. Usecases of Scatter-Gather pattern
● Map-reduce based applications
● OLAP Queries in Data warehouses
● Distributed parallel Processing of sharded databases
○ InitContainer
○ LifeCyclehook: PostStart
○ LifeCyclehook: PreStop
Special features by kubernetes
Init Containers
Application Pod
Application ContainerInit Container
Core Business App
Time
POD
Creation
Request
InitContainer
Exited ENTRYPOINT
triggered
Preparation Logic
Lifecycle hooks
Container
Shutdown
Application Pod
Application Container
PreStop
Hook
PostStart
Hook
Core Business App
Time
POD
Creation
Request
SIGKILL
Termination grace
period
SIGTERM
Init Containers and Lifecycle hooks
Container
shutdown
received
Application Pod
Application Container
Init
Container
preStop
Hook
postStart
Hook
Core Business App
Time
POD
Creation
Request
InitContainer
Exited SIGKILL
Termination grace
period
Visit : www.zekeLabs.com for more details
THANK YOU
Let us know how can we help your organization to Upskill the
employees to stay updated in the ever-evolving IT Industry.
Get in touch:
www.zekeLabs.com | +91-7032051637 | info@zekeLabs.com

Design Patterns for Pods and Containers in Kubernetes - Webinar by zekeLabs