Direct Tools
Rook is designed with Kubernetes design principles from the ground up. This topic is going to escape the bounds of Kubernetes storage and show you how to use block and file storage directly from a pod without any of the Kubernetes magic. The purpose of this topic is to help you quickly test a new configuration, although it is not meant to be used in production. All of the benefits of Kubernetes storage including failover, detach, and attach will not be available. If your pod dies, your mount will die with it.
Start the Direct Mount Pod¶
To test mounting your Ceph volumes, start a pod with the necessary mounts. An example is provided in the examples test directory:
After the pod is started, connect to it like this:
Block Storage Tools¶
After you have created a pool as described in the Block Storage topic, you can create a block image and mount it directly in a pod. This example will show how the Ceph rbd volume can be mounted in the direct mount pod.
Create the Direct Mount Pod.
Create a volume image (10MB):
Map the block volume and format it and mount it:
Write and read a file:
Unmount the Block device¶
Unmount the volume and unmap the kernel device:
Shared Filesystem Tools¶
After you have created a filesystem as described in the Shared Filesystem topic, you can mount the filesystem from multiple pods. The the other topic you may have mounted the filesystem already in the registry pod. Now we will mount the same filesystem in the Direct Mount pod. This is just a simple way to validate the Ceph filesystem and is not recommended for production Kubernetes pods.
Follow Direct Mount Pod to start a pod with the necessary mounts and then proceed with the following commands after connecting to the pod.
Now you should have a mounted filesystem. If you have pushed images to the registry you will see a directory called docker
.
Try writing and reading a file to the shared filesystem.
Unmount the Filesystem¶
To unmount the shared filesystem from the Direct Mount Pod:
No data will be deleted by unmounting the filesystem.