
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
该仓库包含Gluster的CSI(容器存储接口)驱动。容器存储接口(CSI)是一种行业标准,旨在实现集群级卷插件的标准化,使存储供应商(SP)只需开发一次插件,即可在多个容器编排(CO)系统中使用。
本仓库包含源代码和Dockerfile用于构建GlusterFS CSI驱动,采用多阶段容器构建方式,需使用较新版本的Docker或Buildah。
克隆仓库并进入目录:
bash[root@localhost]# git clone https://github.com/gluster/gluster-csi-driver.git [root@localhost]# cd gluster-csi-driver
运行构建脚本:
bash[root@localhost]# ./build.sh
使用CSI驱动前需完成以下环境准备:
注意:可通过https://github.com/gluster/gcs%E5%B7%A5%E5%85%B7%E4%B8%80%E9%94%AE%E9%83%A8%E7%BD%B2%E4%B8%8A%E8%BF%B0%E7%8E%AF%E5%A2%83%EF%BC%8C%E6%97%A0%E9%9C%80%E5%88%86%E5%88%AB%E5%AE%89%E8%A3%85%E3%80%82%E8%AF%A6%E6%83%85%E5%8F%82%E8%A7%81https://github.com/gluster/gcs/blob/master/deploy/README.md%E3%80%82
部署CSI组件
bash[root@localhost]# cd examples/kubernetes/gluster-virtblock/ [root@localhost]# kubectl create -f csi-deployment.yaml service/csi-attacher-glustervirtblockplugin created statefulset.apps/csi-attacher-glustervirtblockplugin created daemonset.apps/csi-nodeplugin-glustervirtblockplugin created service/csi-provisioner-glustervirtblockplugin created statefulset.apps/csi-provisioner-glustervirtblockplugin created serviceaccount/glustervirtblock-csi created clusterrole.rbac.authorization.k8s.io/glustervirtblock-csi created clusterrolebinding.rbac.authorization.k8s.io/glustervirtblock-csi-role created
创建存储类
yaml# storage-class.yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: glustervirtblock-csi annotations: storageclass.kubernetes.io/is-default-class: "false" provisioner: org.gluster.glustervirtblock
bash[root@localhost]# kubectl create -f storage-class.yaml storageclass.storage.k8s.io/glustervirtblock-csi created
验证存储类创建:
bash[root@localhost]# kubectl get storageclass NAME PROVISIONER AGE glustervirtblock-csi org.gluster.glustervirtblock 6s
创建PersistentVolumeClaim (PVC)
yaml# pvc.yaml kind: PersistentVolumeClaim apiVersion: v1 metadata: name: glusterblock-csi-pv spec: storageClassName: glustervirtblock-csi accessModes: - ReadWriteOnce resources: requests: storage: 100Mi
bash[root@localhost]# kubectl create -f pvc.yaml persistentvolumeclaim/glusterblock-csi-pv created
验证PVC状态:
bash[root@localhost]# kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE glusterblock-csi-pv Bound pvc-1048edfb-1f06-11e9-8b7a-525400491c42 100Mi RWO glustervirtblock-csi 8s
创建使用PVC的Pod
yaml# app.yaml apiVersion: v1 kind: Pod metadata: name: gluster-0 labels: app: gluster spec: containers: - name: gluster image: redis imagePullPolicy: IfNotPresent volumeMounts: - mountPath: "/mnt/gluster" name: glusterblockcsivol volumes: - name: glusterblockcsivol persistentVolumeClaim: claimName: glusterblock-csi-pv
bash[root@localhost]# kubectl create -f app.yaml pod/gluster-0 created
验证Pod状态及挂载:
bash[root@localhost]# kubectl get pods NAME READY STATUS RESTARTS AGE gluster-0 1/1 Running 0 38s [root@localhost]# kubectl exec -it gluster-0 -- mount | grep gluster /mnt/blockhostvol/block_hosting_volume_ddd7ced7-7766-4797-9214-01fa9587472a/pvc-1048edfb-1f06-11e9-8b7a-525400491c42 on /mnt/gluster type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
部署CSI组件
bash[root@localhost]# kubectl create -f csi-deployment.yaml service/csi-attacher-glusterfsplugin created statefulset.apps/csi-attacher-glusterfsplugin created daemonset.apps/csi-nodeplugin-glusterfsplugin created service/csi-provisioner-glusterfsplugin created statefulset.apps/csi-provisioner-glusterfsplugin created serviceaccount/glusterfs-csi created clusterrole.rbac.authorization.k8s.io/glusterfs-csi created clusterrolebinding.rbac.authorization.k8s.io/glusterfs-csi-role created
注意:Kubernetes v1.13.1需启用特性门控:
--feature-gates=VolumeSnapshotDataSource=true
创建存储类
yaml# storage-class.yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: glusterfs-csi annotations: storageclass.kubernetes.io/is-default-class: "true" provisioner: org.gluster.glusterfs
bash[root@localhost]# kubectl create -f storage-class.yaml storageclass.storage.k8s.io/glusterfs-csi created
创建PVC及Pod
步骤与RWO类似,PVC访问模式指定为ReadWriteMany,详细操作参见RWO卷声明部分。
yaml# snapshot-class.yaml apiVersion: snapshot.storage.k8s.io/v1alpha1 kind: VolumeSnapshotClass metadata: name: glusterfs-csi-snap snapshotter: org.gluster.glusterfs
bash[root@localhost]# kubectl create -f snapshot-class.yaml volumesnapshotclass.snapshot.storage.k8s.io/glusterfs-csi-snap created
yaml# volume-snapshot.yaml apiVersion: snapshot.storage.k8s.io/v1alpha1 kind: VolumeSnapshot metadata: name: glusterfs-csi-ss spec: snapshotClassName: glusterfs-csi-snap source: name: glusterfs-csi-pv kind: PersistentVolumeClaim
bash[root@localhost]# kubectl create -f volume-snapshot.yaml volumesnapshot.snapshot.storage.k8s.io/glusterfs-csi-ss created
yaml# pvc-restore.yaml apiVersion: v1 kind: PersistentVolumeClaim metadata: name: glusterfs-pv-restore spec: storageClassName: glusterfs-csi dataSource: name: glusterfs-csi-ss kind: VolumeSnapshot apiGroup: snapshot.storage.k8s.io accessModes: - ReadWriteMany resources: requests: storage: 5Gi
bash[root@localhost]# kubectl create -f pvc-restore.yaml persistentvolumeclaim/glusterfs-pv-restore created
创建支持Thin Arbiter的存储类:
yaml# thin-arbiter-virtblock-storageclass.yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: glustervirtblock-csi-thin-arbiter provisioner: org.gluster.glustervirtblock parameters: replicas: "2" arbiterType: "thin" arbiterPath: "192.168.122.121:/mnt/arbiter-path:24007"
使用loopback设备作为brick的存储类:
yaml# glusterfs-lite-storage-class.yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: glusterfs-lite-csi provisioner: org.gluster.glusterfs parameters: brickType: "loop"
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务