Do you know? Well, before today, neither did I.
I’m pretty late to Kubernetes. I heard about it many hears ago, but unfortunately, I had no need to use it at home or at work. Even today, there is no workload that requires me to use a Kubernetes cluster. However, I think I need to learn about it now, as they say “Better late than never”.
Today, I need to access a persistent volume claim (PVC) so taht I can rsync data from a backup to it. The persitent volume (PV) used on my test cluster is Longhorn. Here is the steps that I can used to achieve such task [^1].
- Go to Longhorn UI, attach the volume to a node. For example
- Connect to
r8s-worker1node using SSH. Run
ls -l /dev/longhorn. You will see the block device with the name
[rocky@r8s-worker1 ~]$ ls -l /dev/longhorn/ total 0 brw-rw---- 1 root root 8, 0 Oct 15 07:53 pvc-5242ccd4-5a41-4bb4-b5f8-6f64118f4d33
- Mount the block device to a directory on the
sudo mount /dev/longhorn/<VOLUME-NAME> /mnt/
[rocky@r8s-worker1 ~]$ sudo mount /dev/longhorn/pvc-5242ccd4-5a41-4bb4-b5f8-6f64118f4d33 /mnt
- Now you can access the data at
[rocky@r8s-worker1 ~]$ ls -l /mnt total 40 drwxr-xr-x 2 911 911 4096 Oct 14 14:09 keys drwxr-xr-x 4 911 911 4096 Oct 14 14:09 log drwx------ 2 root root 16384 Oct 14 14:09 lost+found drwxrwxr-x 3 911 911 4096 Oct 15 07:25 nginx drwxr-xr-x 2 911 911 4096 Oct 14 14:09 php drwxr-xr-x 2 911 911 4096 Oct 14 14:09 www
Full credit goes to [^1].