大网数据广告活动
服务器运维问答

Schedule pod on a node and access pv on another node

· 52CE 我爱测

I'm running a k3s cluster on RPi4, with heterogenous config (a node has a high capacity but slow hdd, another has a ssd drive, a third only has a sd card). I have persistent volumes & claims of kind "local-path", attached to node…

问题原文

原帖链接 · spi · CC BY-SA 4.0

I'm running a k3s cluster on RPi4, with heterogenous config (a node has a high capacity but slow hdd, another has a ssd drive, a third only has a sd card).

I have persistent volumes & claims of kind "local-path", attached to nodes & pods depending on my needs.

I'm facing a situation where I need to schedule a pod on the node with no disk to process data stored in the node with the ssd disk (re-encode some video files to mp4 using ffmpeg, and as this is an expensive process I'd like to do this on an idle node and not slow the node running the ssd).

Is it possible to transparently mount a PV from a different node ? Do I need to use some nfs ? Is there a more evoluted type of volume that can be used in bare-metal RPi4 to do what I want ?

Looking at the docs didn't help much (there is tons of different persistent volume type, with not many use-case described).

Thanks

已采纳解答

原帖链接 · matt_j · CC BY-SA 4.0

I think you may be interested in Project Longshorn.
It is a persistent storage implementation for any Kubernetes cluster and it uses the existing disks of your Kubernetes nodes to provide replicated and stable storage for your Kubernetes pods.

As described on Longhorn github:

Longhorn is lightweight, reliable, and powerful. You can install Longhorn on an existing Kubernetes cluster with one kubectl apply command or using Helm charts. Once Longhorn is installed, it adds persistent volume support to the Kubernetes cluster.

And best of all, you can use intuitive GUI dashboard to customize Longhorn to your needs.

Note: At this time Longhorn only supports amd64.

Installation

In the below example, I will show you how to install Longshorn.

First of all you must have open-iscsi installed on each cluster nodes. You need to install it using for example:

apt-get install open-iscsi

Next apply the longhorn.yaml to install Longhorn:

kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/master/deploy/longhorn.yaml

Then create a longhorn StorageClass (you can customize it later using ConfigMap)

kubectl apply -f https://raw.githubusercontent.com/rancher/longhorn/master/deploy/longhorn.yaml

That's all we need to start using Longhorn :)

Longhorn UI

As I described before, we can use helpful GUI dashboard, here you can find how to access it.
In addition, you may need to expose the dashboard to the outside world using Ingress as described here

Using Longhorn UI dashboard is pretty intuitive, e.g. in "Nodes" tab , you can easily specify Nodes dedicated to provide storage.

longhorn StorageClass

You can customize longhorn StorageClass by editing longhorn-storageclass ConfigMap in longhorn-system namespace For example I edited numberOfReplicas parameter from 3 (default) to 1:

root@kmaster:~# kubectl describe sc longhorn
Name:            longhorn
IsDefaultClass:  No
Annotations:     longhorn.io/last-applied-configmap=kind: StorageClass
apiVersion: storage.k8s.io/v1
...
parameters:
  numberOfReplicas: "1"
  staleReplicaTimeout: "2880"
  fromBackup: ""
...

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-01-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。