Day17,NFS provisioner

正文

今天要来安装Kubernetes上的NFS provisioner,主要就是搭配我的DS718+做dynamic provisioner

Github Repo

artifacthub

helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/

检查一下我们准备要使用的路径为IThomeNFS

## 先create一个namespace
kubectl create ns nfs-provisioner

##使用指令简易安装
helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \
    --set nfs.server=192.168.1.107 \
    --set nfs.path=/volume1/IThomeNFS \
    --version 4.0.13 \
    -n nfs-provisioner

安装完成後可以看到如下图

这边要注意,所有节点必须要安装nfs-common(ubuntu),才能够支援nfs mount
retain policy,volumebindmode 这些有需要都要记得在安装时调整

写一份yaml测试,其中pvc指定storage class为nfs-client

apiVersion: v1
kind: Pod
metadata:
  name: test-pv-pod
  namespace: test
spec:
  volumes:
    - name: task-pv-storage
      persistentVolumeClaim:
        claimName: test-pvc
  containers:
    - name: task-pv-container
      image: nginx
      ports:
        - containerPort: 80
          name: "http-server"
      volumeMounts:
        - mountPath: "/usr/share/nginx/html"
          name: task-pv-storage
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: test-pvc
  namespace: test
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: nfs-client
  resources:
    requests:
      storage: 30Gi

成功绑定并运行

exec进入container目录放个档案测试

在本机将nfs目录mount到mnt做检查。

sudo mount -t nfs 192.168.1.107:/volume1/IThomeNFS /mnt

没有问题,确实有资料。

那这样之後有pvc/pv需求时都可以直接用这个storage class了。

闲聊

storage实在也是一门高深的学问,不够懂storage与分散式储存的我往往能选择的也只剩NFS、local persistent volumes这种东西(实在也不敢乱用)......就加减用吧。


<<:  Day2 将麦块农场的电脑「开机」吧!

>>:  什麽是物件导向程序设计 (Object-oriented programming)

铁人赛 Day1 -- 天哪~ 新手村的我到底该不该先学PHP !!

(以下有说错的,在劳烦各位大大告诉我,感谢各位学长姐) 其实一开始我在想说我的SQL资料库要用哪个语...

Day 26 Docker-Compose nginx + flask container with filebeat-another structure

Day 26 Docker-Compose nginx + flask container with...

Day22-TypeScript(TS)的函式(Function) Part2

昨天讲的将函式(Function)加入型别相信大家都了解了, 今天就带大家来看看**完整函式型别(W...

Day13: DockerFile实作Node前後端(上)

Node.js前後端 前几天讲完了Docker的大致的使用说明,今明两天进入实作环节。我们来利用Do...

离职员工删库事件

故事依时间线汇整重点 2017年某月某日离职:曾工(行动影音部)、吴工(开发中心) 2017/02/...