8. Application packaging
• Source code, dependencies, env vars
• Application portability
• Performance consistency
• No more “it works on my machine”
9.
10. OS level virtualization
• Containers share host Operating System
• Lightweight as opposed to a VM
• One host can run multiple containers
• Resource isolation
• Increased efficiency
13. Managing containers
• Which machine is my container running on?
• Are there sufficient resources for my app?
• How do containers communicate with each
other?
• How do I manage load balancing?
• How do I ensure healthcheck/monitoring?
18. Pod
• Smallest deployable unit
• One or more containers
• “one-container-per-pod”
• Unique IP address
Container
Pod
10.10.1.1
Node
19. Deployment
• Pods are ephemeral
• Deployments manage pod life-cycle
• Ensure actual state same as desired
• Provide easy scaling, upgrades for apps
24. Why run stateful apps on k8s?
1. Depends on use case
2. Leverage containerization benefits
3. Manage stateless and stateful apps together
4. Ability to use same infrastructure provider
5. Easy scalability
6. Affordability
25. 1. Containers and Container Orchestration
2.Kubernetes
3.Stateless vs stateful apps
4.Running stateful apps on k8s
26. K8s objects for statefulness
• Persistent Volumes (PV)
• Persistent Volume Claims (PVC)
• Storage Class
• StatefulSet
27. Persistent volume
• Storage resource in k8s
• Volume plugins
• Created by cluster admin
• Lifecycle independent of pod
28. Persistent Volume Claims
• Request to claim a storage resource
• Abstracts storage details of PV from user
• User only specifies size and access mode
• Access modes: RWO, RWM, ROM
30. Limitations?
• User created PVC requesting 3 Gib
• But there was only one PV with 10 Gib
• PV got bound to PVC with excess volume
• User will get a PV-PVC binding only if admin
has created enough PVs
31. Storage Class
• Resource for classifying storage
• Specifies provisioner, parameters, reclaimPolicy
• Created by cluster admin
• User must know name of Storage Class
32. Dynamic Provisioning
Cluster admin
Creates
Storage Class
Name: standard
Provisioner: aws-ebs
Parameters: type=gp2
ReclaimPolicy: Delete
User
Creates PVC
PVC
storageClass: standard
size: 3 GB (min)
AccessMode: RWO
Creates PV
PV
size: 3 GB
AccessMode: RWO
34. Pod in stateful app
• Stores data independently
• Should have separate PV
• Needs separate PVC for separate PV
35. • Lets say you want 10 pods for your app
• Do you create 10 PVCs?
• What about when you want to scale up?
• Can something create PVCs dynamically too?
Pod in stateful app
36. StatefulSets
• Stable unique persistent volume for each pod
• Creates PVC using a volume claim template
• Stable unique network identifier for all pods
• Ordered deployment and scaling
• Automated rolling updates
37. Use Case - Cassandra
• Highly available, scalable
• Uses replication while storing data
• All nodes are equal
• Cassandra nodes can identify each other