k8s/StudyNotes/Storage
- Docker storage - Storage drivers[aufs,btrfs,etc.] and volume's [Local,VMware,rexray/ebs]
- /var/lib/docker/ [aufs, containers, image, volumes]
Create persistent storage for docker container
docker volume create data_vol docker run -v data_vol:/var/lib/mysql mysql # if no pre-created volume docker creates it on the fly docker run --mount type=bind,source=/data/mysql,target=/varlib/mysql mysql
- Bind mount form anywhere, volume mount from /var/lib/docker/volumes/
k8s - Was just docker, now CRI container runtime interface to support docker,rkt, cri-o
- Same for network CNI Container network interface
Same for storage CSI Container Storage Interface - Amazon EBS, PureStorage
- k8s volume options [hostPath:, nfs, awsElasticBlockStore:, etc]
k8s centralize storage with PersistentVolume, then pods claim matching pv with VolumeClaims.
PV(PersistenVolume) on cloud provider still has to manually created.
Automate this with Dynamic Provisioning using StorageClass object
e.g. SC auto creates PV(PersistVol) and PVC(PVclaim) grabs disk from SC
apiVersion: storage.k8s.io/v1 kind: storageClass metadata: name: google-storage provisioner: kubernetes.io/gce-pd parameters: type: pd-standard replication-type: none
In the PVC obj we now refer to the storageClassName: google-storage defined in SC