# Storage
---
## Volumes
---
### On-disk files in a container are "ephemeral"
---
### Problems
1. Losing files when a container chrashes
2. Share file between containers running together in a `Pod`
---
### What about Docker Volums?
- A directory on disk or in another container
- Limited volume drivers
---
## Kubernetes Volumes
---
### Kubernetes Volumes
- Presistent Volumes
- Ephemeral Volumes
---
## Presistent Volumes
---
### Presistent Volumes Resources
- PersistentVolume
- PersistentVolumeClaim
---
### PresistentVolume(PV)
- A piece of storage
- Provisioned by an administrator
- Dynamically provisioned using `Storage Classes`
---
### Storage Classes
Administrators to describe the "classes" of storage they offer
---
### PresistentVolumeClaim(PVC)
- A request of storage by a user
- Specify size & [access modes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes)
---

https://phoenixnap.com/kb/wp-content/uploads/2021/04/graphic-of-persistent-volume-bond.png
---
### Lifecycle of a volume & claim
- Provisoning
- Binding
- Using
- Storage Object in Use Protection
- Reclaiming
- ...
---
### Type of Presistent Volumes

https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes
---
## vSphere Volume
---
### vSphere Volume
- vSphere Cloud Provider Interface
- vSphere Cloud Storage Interface
---
### Cloud Provider Interface
---
The Cloud Provider Interface (CPI) replaces the Kubernetes Controller Manager for only the cloud specific control loops
---

https://github.com/kubernetes/cloud-provider-vsphere/raw/master/docs/images/out-of-tree-arch.png
---
### vSphere Cloud Provider Interface
---
The out-of-tree CPI integration connects to vCenter Server and maps information about your infrastructure, such as VMs, disks, and so on, back to the Kubernetes API
---

https://github.com/kubernetes/cloud-provider-vsphere/raw/master/docs/images/vsphere-out-of-tree-architecture.png
---
### Cloud Native Storage in VMware
---

https://raw.githubusercontent.com/kubernetes-sigs/vsphere-csi-driver/master/docs/images/CNS-Architecture.png
---
### vSphere Cloud Storage Interface Driver
---
### vSphere CSI Driver
- Controller`
- Node
---
### vSphere CSI Controller
- Managing the lifecycle of vSphere volume
- Volume provisioning, attaching and detaching the volume to VMs
- Mounting, formatting and unmounting volumes from the pod within the node VM
---
### vSphere CSI Node
- Formatting, mounting the volumes to nodes
- Using bind mounts for the volumes inside the pod
---
## Demo
---
### Thank you!
{"metaMigratedAt":"2023-06-16T00:30:14.002Z","metaMigratedFrom":"YAML","title":"Stroage","breaks":true,"description":"View the slide with \"Slide Mode\".","contributors":"[{\"id\":\"59ab9413-a782-44fd-bd0d-2aa8517c6051\",\"add\":5385,\"del\":2172}]"}