{"id":813,"date":"2020-09-27T09:41:37","date_gmt":"2020-09-27T01:41:37","guid":{"rendered":"https:\/\/www.linuxdevops.cn\/?p=813"},"modified":"2023-06-09T09:33:53","modified_gmt":"2023-06-09T01:33:53","slug":"helm-creates-kubernetes-storageclass-based-on-nfs","status":"publish","type":"post","link":"https:\/\/www.linuxdevops.cn\/2020\/09\/helm-creates-kubernetes-storageclass-based-on-nfs\/","title":{"rendered":"Helm \u521b\u5efa\u57fa\u4e8enfs \u7684kubernetes storageclass"},"content":{"rendered":"
\u4ecb\u7ecd\uff1a<\/p>\n
\u4f7f\u7528Helm\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u5c06\u81ea\u5b9a\u4e49\u5b58\u50a8\u7c7b\u5b89\u88c5\u5230Kubernetes\u96c6\u7fa4\u4e2d\u3002\u5b83\u8fd8\u5c06NFS\u5ba2\u6237\u7aef\u914d\u7f6e\u7a0b\u5e8f\u5b89\u88c5\u5230\u7fa4\u96c6\u4e2d\uff0c\u8be5\u7fa4\u96c6\u4ece\u5355\u4e2aNFS\u5171\u4eab\u52a8\u6001\u521b\u5efa\u6301\u4e45\u5377\u3002<\/p>\n
\u4e00\u3001NFS \u670d\u52a1\u5668\u7aef\u5b89\u88c5<\/p>\n
#yum \u5b89\u88c5 NFS \u5b89\u88c5\u5305\nyum install nfs-utils\n#\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f\nsystemctl enable rpcbind\nsystemctl enable nfs\n#\u542f\u52a8 NFS \u670d\u52a1\nsystemctl start rpcbind\nsystemctl start nfs\n#\u5728\u670d\u52a1\u7aef\u914d\u7f6e\u4e00\u4e2a\u5171\u4eab\u76ee\u5f55\nmkdir -p \/data\/k8s-test\n#\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\uff0c\u914d\u7f6e\u76f8\u5173\u6743\u9650\nvi \/etc\/exports\n#\u6dfb\u52a0\u5982\u4e0b\u914d\u7f6e\n\/data\/k8s-test 192.168.0.1\/24(rw,sync,no_root_squash,no_all_squash)\n\n#\/opt\/data: \u5171\u4eab\u76ee\u5f55\u4f4d\u7f6e\u3002\n#192.168.0.1\/24: \u5ba2\u6237\u7aef IP \u8303\u56f4\uff0c* \u4ee3\u8868\u6240\u6709\uff0c\u5373\u6ca1\u6709\u9650\u5236\u3002\n#rw: \u6743\u9650\u8bbe\u7f6e\uff0c\u53ef\u8bfb\u53ef\u5199\u3002\n#sync: \u540c\u6b65\u5171\u4eab\u76ee\u5f55\u3002\n#no_root_squash: \u53ef\u4ee5\u4f7f\u7528 root \u6388\u6743\u3002\n#no_all_squash: \u53ef\u4ee5\u4f7f\u7528\u666e\u901a\u7528\u6237\u6388\u6743\u3002\n\n#\u4fee\u6539\u540e\u91cd\u542f\nsystemctl restart nfs\n\n#\u53ef\u4ee5\u68c0\u67e5\u4e00\u4e0b\u672c\u5730\u7684\u5171\u4eab\u76ee\u5f55\nshowmount -e localhost\n#\u8fd9\u6837\uff0c\u670d\u52a1\u7aef\u5c31\u914d\u7f6e\u597d\u4e86<\/code><\/pre>\n\u4e8c\u3001 \u914d\u7f6enfs \u5b58\u50a8\u7c7b\u3002<\/p>\n
1\u3001\u4e0b\u8f7dhelm charts<\/p>\n
helm repo add moikot https:\/\/moikot.github.io\/helm-charts\nhelm pull moikot\/nfs-client-provisioner\n\u89e3\u538b\uff1a\ntar -zxvf nfs-client-provisioner-1.2.9.tgz<\/code><\/pre>\n<\/p>\n
2\u3001\u4fee\u6539values.yaml<\/p>\n
\u4fee\u6539\u4ee5\u4e0b\u90e8\u5206\u3002<\/p>\n
<\/p>\n
\u5b89\u88c5<\/p>\n
helm install nfs-client-provisioner .<\/code><\/pre>\n<\/p>\n
\u68c0\u67e5
\n<\/p>\n
<\/p>\n
\u8be6\u60c5\u53c2\u8003: https:\/\/artifacthub.io\/packages\/helm\/moikot\/nfs-client-provisioner<\/a><\/p>\n\n\u955c\u50cf\u4e0b\u8f7d\u6162\u53ef\u66ff\u6362\u4e3a\u963f\u91cc\u6e90\u955c\u50cf<\/p>\n
registry.cn-hangzhou.aliyuncs.com\/wang_feng\/nfs-client-provisioner:3.1.0<\/p>\n<\/blockquote>\n
\u9519\u8bef\u5904\u7406\uff1a<\/p>\n
\u5982\u679c\u521b\u5efapvc\u65f6\u4e00\u76f4\u5904\u4e8epending\u72b6\u6001\uff0c\u67e5\u770bpvc\u62a5\u9519<\/p>\n
Normal ExternalProvisioning 13s (x2 over 25s) persistentvolume-controller waiting for a volume to be created, either by external provisioner "nfs-client" or manually created by system administrator<\/code><\/pre>\n\u67e5\u770bkubectl logs nfs-client-provisioner-6df55f9474-fdnpc\u7684\u65e5\u5fd7\u6709\u5982\u4e0b\u4fe1\u606f\uff1a<\/p>\n
E1022 07:01:24.615869 1 controller.go:1004] provision "default\/test-claim" class "nfs-storage": unexpected error getting claim reference: selfLink was empty, can't make reference<\/code><\/pre>\n\u53c2\u8003\u4e00\u4e0b\u6587\u7ae0\u5904\u7406\uff1ahttps:\/\/www.cnblogs.com\/xull0651\/p\/15439162.html<\/a><\/p>\n