最新版Ceph( Reef版本)文件存储简单对接k8s(下集)

假如ceph集群已经创建

1.创建cephfs_pool存储池
ceph osd pool create fs_kube_data 16 162.创建cephfs_metadata存储池
ceph osd pool create fs_kube_metadata 16 163 创建cephfs
ceph fs new cephfs01 fs_kube_metadata fs_kube_data4 设置最大活动数
ceph fs set cephfs01 max_mds 25 创建卷子组(非常重要,reef版的文件存储多一步这个)
ceph fs subvolumegroup create cephfs01  myfsg

创建k8s访问cephfs的认证用户

#ceph auth get-or-create client.cephfs01 mon 'allow r' mds 'allow rw' osd 'allow rw pool=cephfs_data, allow rw pool=cephfs_metadata'# ceph auth get client.cephfs01
[client.cephfs01]key = AQAHRD9mmCOLCBAAb+gJ3WBM/KU/FbZEofGOJg==caps mds = "allow rw"caps mon = "allow r"caps osd = "allow rw pool=cephfs_data, allow rw pool=cephfs_metadata"#目前这个版本需要手动创建	# ceph auth get client.cephfs01 > /etc/ceph/ceph.client.cephfs01.keyring

本地测试挂载并创建目录

#目前这个版本需要手动创建	# ceph auth get client.cephfs01 > /etc/ceph/ceph.client.cephfs01.keyring#  mount.ceph ceph-163:6789:/ /mnt -o name=cephfs01,secret=AQAHRD9mmCOLCBAAb+gJ3WBM/KU/FbZEofGOJg==#挂着成功
# df -h | grep mnt
127.0.1.1:6789,192.168.0.163:6789:/  222G     0  222G   0% /mnt

在写你的外部config配置,如果不想使用,就不用写

cat <<EOF > config.yaml
apiVersion: v1
kind: ConfigMap
data:config.json: |-[{"clusterID": "588abbf6-0f74-11ef-ba10-bc2411f077b2","monitors": ["192.168.0.163:6789","192.168.0.164:6789","192.168.0.165:6789"],"cephFS": {"subVolumeGroup": "myfsg"}}]
metadata:name: ceph-csi-config
EOF

本次使用helm安装

请认真阅读完yaml在安装
# egrep -v "^#|^$" values.yaml
---
rbac:# Specifies whether RBAC resources should be createdcreate: true
serviceAccounts:nodeplugin:# Specifies whether a ServiceAccount should be createdcreate: true# The name of the ServiceAccount to use.# If not set and create is true, a name is generated using the fullnamename:provisioner:# Specifies whether a ServiceAccount should be createdcreate: true# The name of the ServiceAccount to use.# If not set and create is true, a name is generated using the fullnamename:
csiConfig:- clusterID: "588abbf6-0f74-11ef-ba10-bc2411f077b2"monitors:- "192.168.0.163:6789"- "192.168.0.164:6789"- "192.168.0.165:6789"cephFS:subvolumeGroup: "myfsg"#netNamespaceFilePath: "{{ .kubeletDir }}/plugins/{{ .driverName }}/net"
commonLabels: {}
logLevel: 5
sidecarLogLevel: 1
CSIDriver:fsGroupPolicy: "File"seLinuxMount: false
nodeplugin:name: nodeplugin# if you are using ceph-fuse client set this value to OnDeleteupdateStrategy: RollingUpdate# set user created priorityclassName for csi plugin pods. default is# system-node-critical which is highest prioritypriorityClassName: system-node-criticalhttpMetrics:# Metrics only available for cephcsi/cephcsi => 1.2.0# Specifies whether http metrics should be exposedenabled: true# The port of the container to expose the metricscontainerPort: 8081service:# Specifies whether a service should be created for the metricsenabled: true# The port to use for the serviceservicePort: 8080type: ClusterIP# Annotations for the service# Example:# annotations:#   prometheus.io/scrape: "true"#   prometheus.io/port: "9080"annotations: {}clusterIP: ""## List of IP addresses at which the stats-exporter service is available## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips##externalIPs: []loadBalancerIP: ""loadBalancerSourceRanges: []## Reference to one or more secrets to be used when pulling images##imagePullSecrets: []# - name: "image-pull-secret"profiling:enabled: falseregistrar:image:repository: registry.cn-shenzhen.aliyuncs.com/neway-sz/uattag: registrar-v2.10.1pullPolicy: IfNotPresentresources: {}plugin:image:repository: quay.io/cephcsi/cephcsi#tag: v3.11-canarytag: canarypullPolicy: IfNotPresentresources: {}nodeSelector: {}tolerations: []affinity: {}# Set to true to enable Ceph Kernel clients# on kernel < 4.17 which support quotas# forcecephkernelclient: true# common mount options to apply all mounting# example: kernelmountoptions: "recover_session=clean"kernelmountoptions: ""fusemountoptions: ""
provisioner:name: provisionerreplicaCount: 1strategy:# RollingUpdate strategy replaces old pods with new ones gradually,# without incurring downtime.type: RollingUpdaterollingUpdate:# maxUnavailable is the maximum number of pods that can be# unavailable during the update process.maxUnavailable: 50%# Timeout for waiting for creation or deletion of a volumetimeout: 60s# cluster name to set on the subvolume# clustername: "k8s-cluster-1"# set user created priorityclassName for csi provisioner pods. default is# system-cluster-critical which is less priority than system-node-criticalpriorityClassName: system-cluster-critical# enable hostnetwork for provisioner pod. default is false# useful for deployments where the podNetwork has no access to cephenableHostNetwork: falsehttpMetrics:# Metrics only available for cephcsi/cephcsi => 1.2.0# Specifies whether http metrics should be exposedenabled: true# The port of the container to expose the metricscontainerPort: 8081service:# Specifies whether a service should be created for the metricsenabled: true# The port to use for the serviceservicePort: 8080type: ClusterIP# Annotations for the service# Example:# annotations:#   prometheus.io/scrape: "true"#   prometheus.io/port: "9080"annotations: {}clusterIP: ""## List of IP addresses at which the stats-exporter service is available## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips##externalIPs: []loadBalancerIP: ""loadBalancerSourceRanges: []## Reference to one or more secrets to be used when pulling images##imagePullSecrets: []# - name: "image-pull-secret"profiling:enabled: falseprovisioner:image:repository: registry.cn-shenzhen.aliyuncs.com/neway-sz/uattag: provisioner-v4.0.1pullPolicy: IfNotPresentresources: {}## For further options, check## https://github.com/kubernetes-csi/external-provisioner#command-line-optionsextraArgs: []# set metadata on volumesetmetadata: trueresizer:name: resizerenabled: trueimage:repository: registry.cn-shenzhen.aliyuncs.com/neway-sz/uattag: resizer-v1.10.1pullPolicy: IfNotPresentresources: {}## For further options, check## https://github.com/kubernetes-csi/external-resizer#recommended-optional-argumentsextraArgs: []snapshotter:image:repository: registry.cn-shenzhen.aliyuncs.com/neway-sz/uattag: snapshotter-v7.0.2pullPolicy: IfNotPresentresources: {}## For further options, check## https://github.com/kubernetes-csi/external-snapshotter#csi-external-snapshotter-sidecar-command-line-optionsextraArgs: []args:# enableVolumeGroupSnapshots enables support for volume group snapshotsenableVolumeGroupSnapshots: falsenodeSelector: {}tolerations: []affinity: {}
selinuxMount: false
storageClass:# Specifies whether the Storage class should be createdcreate: truename: csi-cephfs-sc# Annotations for the storage class# Example:# annotations:#   storageclass.kubernetes.io/is-default-class: "true"annotations: {}# String representing a Ceph cluster to provision storage from.# Should be unique across all Ceph clusters in use for provisioning,# cannot be greater than 36 bytes in length, and should remain immutable for# the lifetime of the StorageClass in use.clusterID: 588abbf6-0f74-11ef-ba10-bc2411f077b2# (required) CephFS filesystem name into which the volume shall be created# eg: fsName: myfsfsName: cephfs01# (optional) Ceph pool into which volume data shall be stored# pool: <cephfs-data-pool># For eg:# pool: "replicapool"#pool: "fs_kube_data"# (optional) Comma separated string of Ceph-fuse mount options.# For eg:# fuseMountOptions: debugfuseMountOptions: ""# (optional) Comma separated string of Cephfs kernel mount options.# Check man mount.ceph for mount options. For eg:# kernelMountOptions: readdir_max_bytes=1048576,norbyteskernelMountOptions: ""# (optional) The driver can use either ceph-fuse (fuse) or# ceph kernelclient (kernel).# If omitted, default volume mounter will be used - this is# determined by probing for ceph-fuse and mount.ceph# mounter: kernelmounter: ""# (optional) Prefix to use for naming subvolumes.# If omitted, defaults to "csi-vol-".# volumeNamePrefix: "foo-bar-"volumeNamePrefix: ""# The secrets have to contain user and/or Ceph admin credentials.provisionerSecret: csi-cephfs-secret# If the Namespaces are not specified, the secrets are assumed to# be in the Release namespace.provisionerSecretNamespace: ""controllerExpandSecret: csi-cephfs-secretcontrollerExpandSecretNamespace: ""nodeStageSecret: csi-cephfs-secretnodeStageSecretNamespace: ""reclaimPolicy: DeleteallowVolumeExpansion: truemountOptions:# Mount Options# Example:#mountOptions:- discard
secret:# Specifies whether the secret should be createdcreate: truename: csi-cephfs-secretannotations: {}# Key values correspond to a user name and its key, as defined in the# ceph cluster. User ID should have required access to the 'pool'# specified in the storage classuserID: cephfs01userKey: AQAHRD9mmCOLCBAAb+gJ3WBM/KU/FbZEofGOJg==adminID: adminadminKey: AQASMz9mgVCqNxAABEAu/WYy0gaEcTC5zC60Ug==
cephconf: |[global]auth_cluster_required = cephxauth_service_required = cephxauth_client_required = cephx# ceph-fuse which uses libfuse2 by default has write buffer size of 2KiB# adding 'fuse_big_writes = true' option by default to override this limit# see https://github.com/ceph/ceph-csi/issues/1928#fuse_big_writes = true
extraDeploy: []
provisionerSocketFile: csi-provisioner.sock
pluginSocketFile: csi.sock
kubeletDir: /var/lib/kubelet
driverName: cephfs.csi.ceph.com
configMapName: ceph-csi-config
externallyManagedConfigmap: false   <<<<----如果你是外部config文件就改成true
cephConfConfigMapName: ceph-config

最后部署你的csi驱动

helm 安装包点击下载

链接:分享文件:ceph-csi-cephfs-3.11.0.tgz

 helm install -n ceph-csi-cephfs ceph-csi-cephfs ceph-csi-cephfs-3.11.0.tgz -f values.yaml

在这里插入图片描述

编辑一个demon

cat <<EOF > pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:name: csi-cephfs-pvc
spec:accessModes:- ReadWriteManyresources:requests:storage: 1GistorageClassName: csi-cephfs-sc
EOF

不在解释了

# kubectl get pvc
NAME             STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS    AGE
csi-cephfs-pvc   Bound    pvc-e29b9393-9473-4c59-b981-0e24d5835018   1Gi        RWX            csi-cephfs-sc   31m

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/690269.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

CCF CSP 认证考试历年真题满分题解(所有前四题)

CCF CSP 认证考试历年真题满分题解&#xff08;所有前四题&#xff09; 前言 原本刷题的动机仅仅是为研究生复试的机试环节做准备&#xff0c;我通过刷csp的真题来锻炼自己&#xff0c;因为上次的机试题目全部是csp真题&#xff0c;最后也是顺利上岸。空闲之际&#xff0c;我…

大模型prompt实例:知识库信息质量校验模块

大模型相关目录 大模型&#xff0c;包括部署微调prompt/Agent应用开发、知识库增强、数据库增强、知识图谱增强、自然语言处理、多模态等大模型应用开发内容 从0起步&#xff0c;扬帆起航。 大模型应用向开发路径&#xff1a;AI代理工作流大模型应用开发实用开源项目汇总大模…

关于DDD和COLA的一些总结和思考

1|0思维&#xff1a;面向对象和面向过程 领域驱动设计本质上是讲的面向对象&#xff0c;但是谈面向对象&#xff0c;始终无法绕开面向过程&#xff0c;所以我们先好好说一下面向过程和面向对象这两个概念。 什么是面向过程呢&#xff0c;其实就是我们学习编程时最初被植入的逻辑…

CTF数据安全大赛crypto题目解题过程

CTF-Crypto加密题目内容 下面是一个Base64加密的密文 bXNobnszODdoajM3MzM1NzExMzQxMmo4MGg0bDVoMDYzNDQzNH0原文链接&#xff1a; 数据安全大赛CTF-Crypto题目 - 红客网-网络安全与渗透技术 我们用Python写一个解密脚本&#xff1a; import base64 import time #base64加密…

从静态PPT到智能演讲——人工智能在演示文稿中的应用

1.概述 在这个信息过载的时代&#xff0c;能够吸引并持续吸引观众的注意力无疑成为了一项艰巨的任务。公众演讲领域正经历着一场由人工智能&#xff08;AI&#xff09;引领的革命。AI不仅在制作引人入胜的内容方面发挥作用&#xff0c;而且在分析演讲的传递方式上也起着关键作…

返回分类信息(带层级)

文章目录 1.前端展示分类管理信息1.目前项目架构2.启动前后端项目1.启动mysql容器2.启动后端 renren-fast3.启动前端1.界面2.用户名密码都是admin 3.创建分类管理菜单1.菜单管理 -> 新增 -> 新增目录2.刷新3.能够新增菜单的原因是前端脚手架与renren-fast后端脚手架通信&…

ego_planner学习

飞行类型 enum TARGET_TYPE { MANUAL_TARGET 1, PRESET_TARGET 2, REFENCE_PATH 3 }; target_type_ TARGET_TYPE::PRESET_TARGET) trigger_sub_ nh.subscribe("/traj_start_trigger", 1, &EGOReplanFSM::triggerCallback, this); nh.param("fsm/waypo…

两个系统中的数据匹配方法

一、首先介绍几种常用的相似度计算 1.1最长公共子序列(LCS) 最长公共子序列&#xff08;Longest Common Subsequence&#xff0c;简称LCS&#xff09;是在两个或多个序列中寻找最长的公共子序列的问题。这里所说的“子序列”指的是原序列中元素的子集&#xff0c;但保持元素的原…

Linux基础之进程的基本概念

目录 一、进程的基本概念 1.1 什么是进程 1.2 PCB的概念 1.3 进程的查看 1.3.1 查看进程方式一 1.3.2 查看进程的方式二 1.4 父进程与子进程 一、进程的基本概念 1.1 什么是进程 进程是什么&#xff1f; 课本概念&#xff1a;程序的一个执行实例&#xff0c;正在执行的…

2024年618值得安利的数码好物有哪些?年度值得入手的数码清单分享

随着2024年618购物节的到来&#xff0c;各类数码好物纷至沓来&#xff0c;为消费者提供了丰富多样的选择&#xff0c;在这个充满诱惑的购物狂欢中&#xff0c;哪些数码产品值得我们重点关注和入手呢&#xff1f;接下来就让我们一起探索这份年度值得入手的数码清单&#xff0c;分…

loongarch64 electron打包deb改成符合统信测试通过的deb

需要做软件适配统信系统的自主认证。 我之前是在 麒麟 龙芯 loongarch64 电脑上使用 electron 打包的 deb包&#xff1a;麒麟龙芯loongarch64 electron 打包deb包_electron麒麟系统打包的-CSDN博客 安装在统信电脑 处理器&#xff1a;Loongson-3A60000-HV 2.5GHz 可以使用&…

flstudio21中文版2024最新下载安装图文使用教程

FL Studio 21.2.3.4004中文版 中文别名水果编曲软件&#xff0c;是一款全能的音乐制作软件&#xff0c;包括编曲、录音、剪辑和混音等诸多功能&#xff0c;让你的电脑编程一个全能的录音室&#xff0c;它为您提供了一个集成的开发环境&#xff0c;使用起来非常简单有效&#xf…