私有托管的 Kubernetes 存储?
Privately hosted Kubernetes storage?
我正在寻找 Kubernetes 存储的解决方案,我可以在其中使用我的 UnRaid 服务器作为我的 Kubernetes 集群的存储。有人做过这样的事情吗?
如有任何帮助,我们将不胜感激。
谢谢,
杰米
可能唯一的方法就是使用它 NFS Volume. This link 让您了解如何挂载 Unraid NFS 共享。
然后您可以按照Kubernetes example了解如何在 Pod 中使用 NFS 卷。
基本上,您的 Unraid 服务器将有一个 IP 地址,然后您可以使用该 IP 地址在您的 Pod 上安装 volume/path。 For example:
kind: Pod
apiVersion: v1
metadata:
name: pod-using-nfs
spec:
# Add the server as an NFS volume for the pod
volumes:
- name: nfs-volume
nfs:
# URL for the NFS server
server: 10.108.211.244 # Change this!
path: /
# In this container, we'll mount the NFS volume
# and write the date to a file inside it.
containers:
- name: app
image: alpine
# Mount the NFS volume in the container
volumeMounts:
- name: nfs-volume
mountPath: /var/nfs
# Write to a file inside our NFS
command: ["/bin/sh"]
args: ["-c", "while true; do date >> /var/nfs/dates.txt; sleep 5; done"]
您也可以使用 PVC if you'd like. For example:
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
nfs:
server: 10.108.211.244 # Change this!
path: "/"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: nfs
spec:
accessModes:
- ReadWriteMany
storageClassName: ""
resources:
requests:
storage: 10G
然后在您的 Deployment 或 Pod 定义中使用它:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nfs-busybox
spec:
replicas: 1
selector:
matchLabels:
name: nfs-busybox
template:
metadata:
labels:
name: nfs-busybox
spec:
containers:
- image: busybox
imagePullPolicy: Always
name: busybox
volumeMounts:
# name must match the volume name below
- name: my-pvc-nfs
mountPath: "/mnt"
volumes:
- name: my-pvc-nfs
persistentVolumeClaim:
claimName: nfs
你可以使用 ceph 。我使用它并且它帮助了我很多。您可以从您的存储构建一个集群并定义复制。
你可以通过 ceph
使用增量备份和快照
您可以尝试 Kadalu(https://kadalu.io) 项目。
Kadalu 容器存储是为 Kubernetes 中的应用程序 运行 提供持久存储的解决方案。该项目使用 GlusterFS 提供 k8s 存储,但与 Kubernetes 原生集成。
安装Kadalu Operator,然后注册存储设备。例如,下面的命令从节点 kube-node1.example.com
(它是 k8s 集群的一部分)公开存储设备 /dev/vdc
。操作员部署 CSI 驱动程序,这些驱动程序需要服务持久卷声明 (PVC)。
安装 Kadalu Operator
[kube-master]# kubectl create -f https://kadalu.io/operator-latest.yaml
注册存储设备
[kube-master]# kubectl kadalu storage-add storage-pool-1 \
--device kube-node1.example.com:/dev/vdc
验证所有必需的 pods 都是 运行
[kube-master]# kubectl get pods -nkadalu
NAME READY STATUS RESTARTS AGE
csi-nodeplugin-5hfms 3/3 Running 0 14m
csi-nodeplugin-924cc 3/3 Running 0 14m
csi-nodeplugin-cbjl9 3/3 Running 0 14m
csi-provisioner-0 4/4 Running 0 14m
operator-577f569dc8-l2q6c 1/1 Running 0 15m
server-storage-pool-1-0-kube... 2/2 Running 0 11m
就是这样。开始领取 PV!
PV 声明示例。
# File: sample-pvc.yaml
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: sample-pv
spec:
storageClassName: kadalu.replica1
accessModes:
- ReadWriteMany
resources:
requests:
storage: 500M
运行 下面的命令请求 sample-pv
[kube-master]# kubectl create -f sample-pvc.yaml
注意:Kadalu也支持Replica3配置,即需要注册三台设备。 Replica 3 为应用程序提供高可用性,即使三个存储节点中的一个已关闭。例如,
[kube-master]# kubectl kadalu storage-add storage-pool-2 --type Replica3 \
--device kube-node1.example.com:/dev/vdc
--device kube-node2.example.com:/dev/vdc
--device kube-node3.example.com:/dev/vdc
希望这有用。欢迎在此处提出问题或请求功能 https://github.com/kadalu/kadalu/issues
我正在寻找 Kubernetes 存储的解决方案,我可以在其中使用我的 UnRaid 服务器作为我的 Kubernetes 集群的存储。有人做过这样的事情吗?
如有任何帮助,我们将不胜感激。
谢谢, 杰米
可能唯一的方法就是使用它 NFS Volume. This link 让您了解如何挂载 Unraid NFS 共享。
然后您可以按照Kubernetes example了解如何在 Pod 中使用 NFS 卷。
基本上,您的 Unraid 服务器将有一个 IP 地址,然后您可以使用该 IP 地址在您的 Pod 上安装 volume/path。 For example:
kind: Pod
apiVersion: v1
metadata:
name: pod-using-nfs
spec:
# Add the server as an NFS volume for the pod
volumes:
- name: nfs-volume
nfs:
# URL for the NFS server
server: 10.108.211.244 # Change this!
path: /
# In this container, we'll mount the NFS volume
# and write the date to a file inside it.
containers:
- name: app
image: alpine
# Mount the NFS volume in the container
volumeMounts:
- name: nfs-volume
mountPath: /var/nfs
# Write to a file inside our NFS
command: ["/bin/sh"]
args: ["-c", "while true; do date >> /var/nfs/dates.txt; sleep 5; done"]
您也可以使用 PVC if you'd like. For example:
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
nfs:
server: 10.108.211.244 # Change this!
path: "/"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: nfs
spec:
accessModes:
- ReadWriteMany
storageClassName: ""
resources:
requests:
storage: 10G
然后在您的 Deployment 或 Pod 定义中使用它:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nfs-busybox
spec:
replicas: 1
selector:
matchLabels:
name: nfs-busybox
template:
metadata:
labels:
name: nfs-busybox
spec:
containers:
- image: busybox
imagePullPolicy: Always
name: busybox
volumeMounts:
# name must match the volume name below
- name: my-pvc-nfs
mountPath: "/mnt"
volumes:
- name: my-pvc-nfs
persistentVolumeClaim:
claimName: nfs
你可以使用 ceph 。我使用它并且它帮助了我很多。您可以从您的存储构建一个集群并定义复制。 你可以通过 ceph
使用增量备份和快照您可以尝试 Kadalu(https://kadalu.io) 项目。
Kadalu 容器存储是为 Kubernetes 中的应用程序 运行 提供持久存储的解决方案。该项目使用 GlusterFS 提供 k8s 存储,但与 Kubernetes 原生集成。
安装Kadalu Operator,然后注册存储设备。例如,下面的命令从节点 kube-node1.example.com
(它是 k8s 集群的一部分)公开存储设备 /dev/vdc
。操作员部署 CSI 驱动程序,这些驱动程序需要服务持久卷声明 (PVC)。
安装 Kadalu Operator
[kube-master]# kubectl create -f https://kadalu.io/operator-latest.yaml
注册存储设备
[kube-master]# kubectl kadalu storage-add storage-pool-1 \
--device kube-node1.example.com:/dev/vdc
验证所有必需的 pods 都是 运行
[kube-master]# kubectl get pods -nkadalu
NAME READY STATUS RESTARTS AGE
csi-nodeplugin-5hfms 3/3 Running 0 14m
csi-nodeplugin-924cc 3/3 Running 0 14m
csi-nodeplugin-cbjl9 3/3 Running 0 14m
csi-provisioner-0 4/4 Running 0 14m
operator-577f569dc8-l2q6c 1/1 Running 0 15m
server-storage-pool-1-0-kube... 2/2 Running 0 11m
就是这样。开始领取 PV!
PV 声明示例。
# File: sample-pvc.yaml
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: sample-pv
spec:
storageClassName: kadalu.replica1
accessModes:
- ReadWriteMany
resources:
requests:
storage: 500M
运行 下面的命令请求 sample-pv
[kube-master]# kubectl create -f sample-pvc.yaml
注意:Kadalu也支持Replica3配置,即需要注册三台设备。 Replica 3 为应用程序提供高可用性,即使三个存储节点中的一个已关闭。例如,
[kube-master]# kubectl kadalu storage-add storage-pool-2 --type Replica3 \
--device kube-node1.example.com:/dev/vdc
--device kube-node2.example.com:/dev/vdc
--device kube-node3.example.com:/dev/vdc
希望这有用。欢迎在此处提出问题或请求功能 https://github.com/kadalu/kadalu/issues