Kubernetes:使用NFS的动态持久卷配置 [英] Kubernetes : Dynamic Persistent Volume provisioning using NFS
问题描述
我有多节点kubernetes设置.我正在尝试使用带有NFS卷插件的存储类来动态分配持久卷. 我找到了glusterfs,aws-ebs等的存储类示例,但是没有找到NFS的任何示例. 如果仅创建PV和PVC,则NFS可以很好地工作(没有存储类). 我试图通过引用其他插件为NFS编写存储类文件.请在下面参考,
I have multi node kubernetes setup. I am trying to allocate a Persistent volume dynamically using storage classes with NFS volume plugin. I found storage classes examples for glusterfs, aws-ebs, etc.but, I didn't find any example for NFS. If I create PV and PVC only then NFS works very well(Without storage class). I tried to write storage class file for NFS, by referring other plugins. please refer it below,
nfs-storage-class.yaml
nfs-storage-class.yaml
kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
namespace: kube-system
name: my-storage
annotations:
storageclass.beta.kubernetes.io/is-default-class: "true"
labels:
kubernetes.io/cluster-service: "true"
provisioner: kubernetes.io/nfs
parameters:
path: /nfsfileshare
server: <nfs-server-ip>
nfs-pv-claim.yaml
nfs-pv-claim.yaml
apiVersion: v1
metadata:
name: demo-claim
annotations:
volume.beta.kubernetes.io/storage-class: my-storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
它没有用.所以,我的问题是,我们可以为NFS编写存储类吗?它支持动态提供吗?
It didn't worked. So, my question is, Can we write a storage class for NFS? Does it support dynamic provisioing?
推荐答案
使用NFS进行动态存储配置不起作用,最好使用glusterfs.有一个很好的教程,解决了设置过程中的常见问题. http://blog.lwolf.org/post /how-i-deployed-glusterfs-cluster-to-kubernetes/
Dynamic storage provisioning using NFS doesn't work, better use glusterfs. There's a good tutorial with fixed to common problems while setting up. http://blog.lwolf.org/post/how-i-deployed-glusterfs-cluster-to-kubernetes/
这篇关于Kubernetes:使用NFS的动态持久卷配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!