gpt4 book ai didi

kubernetes - 私有(private)托管的 Kubernetes 存储?

转载 作者:行者123 更新时间:2023-12-02 12:04:37 25 4
gpt4 key购买 nike

我正在寻找一种 Kubernetes 存储解决方案,我可以在其中使用我的 UnRaid 服务器作为 Kubernetes 集群的存储。有没有人做过这样的事情?

任何帮助将非常感激。

谢谢,
杰米

最佳答案

可能唯一的方法是使用 NFS Volume .这个link让您了解如何挂载 Unraid NFS 共享。

然后你可以关注Kubernetes example关于如何在 Pod 中使用 NFS 卷。

基本上,您的 Unraid 服务器将有一个 IP 地址,然后您可以使用该 IP 地址在您的 Pod 上安装卷/路径。 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如果你愿意。 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

关于kubernetes - 私有(private)托管的 Kubernetes 存储?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55681165/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com