Skip to content

Commit

Permalink
feat: k8s volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
fadyat committed Nov 8, 2023
1 parent 2f76a9d commit 5304f90
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dump/kubernetes/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
- [Basic](./k8s.md)
Some notes on Kubernetes.

- [Some stupid basics](./stupid-basics.md)
- [Deployment strategies](./deployment-types.md)
- [Volumes](./volumes.md)
- [CSI](./csi.md)
- [CRD](./crd.md)
2 changes: 2 additions & 0 deletions dump/kubernetes/crd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

todo: add more info
8 changes: 8 additions & 0 deletions dump/kubernetes/csi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Container Storage Interface (CSI)

Container Storage Interface (CSI) is an initiative to unify the storage interface of Container Orchestrator (CO) systems
like Kubernetes, Mesos, Docker, Cloud Foundry, etc. combined with a storage vendors like Ceph, Portworx, NetApp, etc.

This means, implementing a single CSI for a storage vendor is guaranteed to work with all COs.

todo: add more info
Binary file added dump/kubernetes/docs/volumes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
54 changes: 54 additions & 0 deletions dump/kubernetes/volumes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Volumes

## Requirements

- Storage doesn't depend on pod lifecycle.
- Storage must be available on all nodes
- Storage needs to survive even if cluster crashes

## Types

Persistent Volume (PV)

- cluster resource
- need actual physical storage (local disk, cloud storage, etc.)
- physical storage needs to be pre-configured, PV is just a reference to it
- attributes are different depending on storage type
- PV are not namespaced, they are cluster-wide
- admin provides PV

Persistent Volume Claim (PVC)

- request for storage by user
- consists of some criteria (size, access mode, etc.)
- claim tries to find PV that matches criteria
- PVC are namespaced

We need PVC to use PV, because we don't want to know where PV is located, we just want to use it.

Storage Class

- SC provides dynamic provisioning of PV
- when PVC claims storage, SC creates PV for it
- requested in PVC, SC creates PV, PVC binds to PV

## Provisioning

Provisioning is the process of creating storage, it can be done statically or dynamically.

Static means, that admin creates PV manually, and then user can use it.

Dynamic means, that user creates PVC, and then PV is created automatically, via Storage Class.

<img src="./docs/volumes.png" width="600">

## Summary

- Volume is a directory, possibly with some data in it, which is accessible to the containers in a pod.
- How made available, backed by which storage medium - depends on the volume type.
- Can't bind 2 PVC to 1 PV, but can bind 2 pods to 1 PVC.

### Resources

- https://www.youtube.com/watch?v=0swOh5C3OVM
- https://www.youtube.com/watch?v=OulmwTYTauI

0 comments on commit 5304f90

Please sign in to comment.