juicefs csi 集成试用

主要是一个试用,对于k8s 使用了minikube

minikube 安装

这个直接可以参考官方文档 (注意可能需要合理上网)

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64
sudo install minikube-darwin-amd64 /usr/local/bin/minikube
minikube start

部署juicefs csi driver

官方提供了部署文档参考

  • 部署csi driver
kubectl apply -f https://raw.githubusercontent.com/juicedata/juicefs-csi-driver/master/deploy/k8s.yaml
  • 动态配置
    secret
 
kubectl -n default create secret generic juicefs-secret \
    --from-literal=name=mydemoapp \
    --from-literal=metaurl=redis://@<redis>:6379 \
    --from-literal=storage=minio \
    --from-literal=bucket=http://<endpoint>/juicefsapp \
    --from-literal=access-key=<key>\
    --from-literal=secret-key=<secret>
  • 创建存储类以及pv&pvc&pod
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: juicefs-sc
  namespace: default
provisioner: csi.juicefs.com
parameters:
  csi.storage.k8s.io/provisioner-secret-name: juicefs-secret
  csi.storage.k8s.io/provisioner-secret-namespace: default
  csi.storage.k8s.io/node-publish-secret-name: juicefs-secret
  csi.storage.k8s.io/node-publish-secret-namespace: default
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: juicefs-pvc
  namespace: default
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 10Pi
  storageClassName: juicefs-sc
---
apiVersion: v1
kind: Pod
metadata:
  name: juicefs-app
  namespace: default
spec:
  containers:
  - args:
    - -c
    - while true; do echo $(date -u) >> /data/out.txt; sleep 5; done
    command:
    - /bin/sh
    image: centos
    name: app
    volumeMounts:
    - mountPath: /data
      name: juicefs-pv
  volumes:
  - name: juicefs-pv
    persistentVolumeClaim:
      claimName: juicefs-pvc
  • 效果

minikube dashboard

 

 

 

 

说明

官方提供了一些最佳实践很值得学习下,同时源码也是值得学习的

参考资料

https://juicefs.com/blog/cn/posts/csi-driver-best-practices/
https://minikube.sigs.k8s.io/docs/start/
https://juicefs.com/docs/zh/csi/introduction

posted on   荣锋亮  阅读(256)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2021-01-06 grafana tempo 分布式追踪框架学习试用
2021-01-06 synthetic-load-generator 一个不错的opentracing trace && metrics && logs 生成工具
2021-01-06 记一次php.ini配置不合理造成系统加载偏慢问题
2019-01-06 使用nexus 管理pip 私有包
2018-01-06 让nodejs 支持 es6 import

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示