CKA 8: Storage
Docker image has all read only layer. top most layer is writable.
docker run -v VOLUME_NAME:/dir/path/inside/container IMAGE_NAME //volume mount
docker volume create VOLUME_NAME
It create volume at path /var/lib/docker/volumes/VOLUME_NAME
docker run -v /host/path:/dir/path/inside/container IMAGE_NAME //bind mount
is same as:
docker run --mount type=bind,source=/host/path,target=/dir/path/inside/container
Docker storage driver
AUFS, ZFS, BTRFS, Device mapper, overlay, overlay2
Docker choose appropriate driver based on OS.
Default volume driver plugins at Docker is local
Other driver can be specified with
docker --volume-driver
option
CSI is supported by K8s, Cloud Foundry and Mesos.
CSI =
- a set of RPCs
-- Create Volume
-- Delete Volume
-- Controller Publish Volume
with parameters and error code
in YAML file
volumes:
- name: data-volume
hostPath:
path: /host/path
type: Directory
To bind specific PV, and PVC: PV shall have
labels:
name: my-pv
PVC shall have
selector:
matchLabels:
name: my-pv
PV can be greater than PVC
PV and PVC have one to one relation. So unused volume is waste if PV > PVC
PVC capacity is same PV capacity if PV > PVC
Criteria for binding
- Sufficient Capacity
- Access Modes
- Volume Modes
- Storage Class
- Selector
If a PVC is used by pod, and if we delete it, then it gets stuck at 'Terminating' state
If a PVC is not used by pod, and if we delete it, then PV status is 'Released'
Also refer:
https://layers7.blogspot.com/2020/04/ckad-5-deployment-configuration.html
http://layers7.blogspot.com/2019/03/docker-volume.html
docker run -v VOLUME_NAME:/dir/path/inside/container IMAGE_NAME //volume mount
docker volume create VOLUME_NAME
It create volume at path /var/lib/docker/volumes/VOLUME_NAME
docker run -v /host/path:/dir/path/inside/container IMAGE_NAME //bind mount
is same as:
docker run --mount type=bind,source=/host/path,target=/dir/path/inside/container
Docker storage driver
AUFS, ZFS, BTRFS, Device mapper, overlay, overlay2
Docker choose appropriate driver based on OS.
Default volume driver plugins at Docker is local
Other driver can be specified with
docker --volume-driver
option
CSI is supported by K8s, Cloud Foundry and Mesos.
CSI =
- a set of RPCs
-- Create Volume
-- Delete Volume
-- Controller Publish Volume
with parameters and error code
in YAML file
volumes:
- name: data-volume
hostPath:
path: /host/path
type: Directory
To bind specific PV, and PVC: PV shall have
labels:
name: my-pv
PVC shall have
selector:
matchLabels:
name: my-pv
PV can be greater than PVC
PV and PVC have one to one relation. So unused volume is waste if PV > PVC
PVC capacity is same PV capacity if PV > PVC
Criteria for binding
- Sufficient Capacity
- Access Modes
- Volume Modes
- Storage Class
- Selector
If a PVC is used by pod, and if we delete it, then it gets stuck at 'Terminating' state
If a PVC is not used by pod, and if we delete it, then PV status is 'Released'
Also refer:
https://layers7.blogspot.com/2020/04/ckad-5-deployment-configuration.html
http://layers7.blogspot.com/2019/03/docker-volume.html
0 comments:
Post a Comment