I've worked with them and imitated other configurations to write a new configurations. But I've never understood what mounting means. What persistent volume means? And where do its roots lie in? I really want to understand from the base. Can anyone tell me what's the base/foundation of this?
Currently, requiring to make logs persistent in my homelab and I've no idea except surface level idea of where I should mount what.
The objective is to store the logs of a pod--->server. But There are various configurations in rancher, that I am not quite getting.
Thus I feel I lack basic foundational knowledge of mounting. Where do the roots of all these lie?
A (filesystem-)mount hooks a storage resource with a filesystem into the existing filesystem.
The command df -T /directory/file tells the filesystem the file is on.
Just df -T shows all mounted filesystems.
I think persistent volume (e.g. a storage resource in kubernetes) means it is not deleted if the using pod is deleted. It is tied to a volume claim rather than a pod.
And via an API it can be accessed from outside the pod.
This will show you the persistent mounts of all containers on a server docker ps -a --format 'table{{.Names}}\t{{.Mounts}} --no-trunc
Similar to mounting real filesystems on a physical host we can mount directories on the real filesystem within docker containers, this is typically used to allow alterations to configuration settings outside the container and to persist logs / audit trails.
You can add a persistent volume to a container at runtime like so docker run -d --name my_container_image --mount source=/etc/sshd, target=/conf
This is a volume that persists regardless of the status of the docker container (running, stopped, destroyed). The data persists on computer system (for example, a hard drive) independent of the status of the container.
The filesystem, not the docker container.
The filesystem.
You can create a mount point on the filesystem outside the docker container for any part of the docker filesystem.
You can set up the mount point for the persistent data as it pleases you, as long as the directory structure exists.
A docker container exists in the filesystem, but in it's own filesystem space.
When you destroy the container, all the data is gone from the computer.
If you want data to persist, you need a way to store the data outside the docker filesystem; that is why when you destroy the container, the data persists outside the container.
So, as long as you store the data outside the container in an appropriate place, when you destroy the container, the data will persist.
Normally, this persistence is required for databases, log files, and configuration files, and other files which need to persist when the container is destroyed.
So, all roads lead to understanding the filesystem outside the container and the filesystem inside the container. The data in the filesystem outside the container persists when the container goes bye-bye. The data in the container which is not a part of the original container is lost when you destroy the container.
So, if you do not want your data to go bye-bye, you must store the data in a filesystem outside the container.