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

假如ceph集群已经创建

1.创建cephfs_pool存储池
ceph osd pool create fs_kube_data 16 16

2.创建cephfs_metadata存储池
ceph osd pool create fs_kube_metadata 16 16

3 创建cephfs
ceph fs new cephfs01 fs_kube_metadata fs_kube_data

4 设置最大活动数
ceph fs set cephfs01 max_mds 2

5 创建卷子组(非常重要,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 created
  create: true
serviceAccounts:
  nodeplugin:
    # Specifies whether a ServiceAccount should be created
    create: true
    # The name of the ServiceAccount to use.
    # If not set and create is true, a name is generated using the fullname
    name:
  provisioner:
    # Specifies whether a ServiceAccount should be created
    create: true
    # The name of the ServiceAccount to use.
    # If not set and create is true, a name is generated using the fullname
    name:
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 OnDelete
  updateStrategy: RollingUpdate
  # set user created priorityclassName for csi plugin pods. default is
  # system-node-critical which is highest priority
  priorityClassName: system-node-critical
  httpMetrics:
    # Metrics only available for cephcsi/cephcsi => 1.2.0
    # Specifies whether http metrics should be exposed
    enabled: true
    # The port of the container to expose the metrics
    containerPort: 8081
    service:
      # Specifies whether a service should be created for the metrics
      enabled: true
      # The port to use for the service
      servicePort: 8080
      type: 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: false
  registrar:
    image:
      repository: registry.cn-shenzhen.aliyuncs.com/neway-sz/uat
      tag: registrar-v2.10.1
      pullPolicy: IfNotPresent
    resources: {}
  plugin:
    image:
      repository: quay.io/cephcsi/cephcsi
      #tag: v3.11-canary
      tag: canary
      pullPolicy: IfNotPresent
    resources: {}
  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: provisioner
  replicaCount: 1
  strategy:
    # RollingUpdate strategy replaces old pods with new ones gradually,
    # without incurring downtime.
    type: RollingUpdate
    rollingUpdate:
      # 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 volume
  timeout: 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-critical
  priorityClassName: system-cluster-critical
  # enable hostnetwork for provisioner pod. default is false
  # useful for deployments where the podNetwork has no access to ceph
  enableHostNetwork: false
  httpMetrics:
    # Metrics only available for cephcsi/cephcsi => 1.2.0
    # Specifies whether http metrics should be exposed
    enabled: true
    # The port of the container to expose the metrics
    containerPort: 8081
    service:
      # Specifies whether a service should be created for the metrics
      enabled: true
      # The port to use for the service
      servicePort: 8080
      type: 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: false
  provisioner:
    image:
      repository: registry.cn-shenzhen.aliyuncs.com/neway-sz/uat
      tag: provisioner-v4.0.1
      pullPolicy: IfNotPresent
    resources: {}
    ## For further options, check
    ## https://github.com/kubernetes-csi/external-provisioner#command-line-options
    extraArgs: []
  # set metadata on volume
  setmetadata: true
  resizer:
    name: resizer
    enabled: true
    image:
      repository: registry.cn-shenzhen.aliyuncs.com/neway-sz/uat
      tag: resizer-v1.10.1
      pullPolicy: IfNotPresent
    resources: {}
    ## For further options, check
    ## https://github.com/kubernetes-csi/external-resizer#recommended-optional-arguments
    extraArgs: []
  snapshotter:
    image:
      repository: registry.cn-shenzhen.aliyuncs.com/neway-sz/uat
      tag: snapshotter-v7.0.2
      pullPolicy: IfNotPresent
    resources: {}
    ## For further options, check
    ## https://github.com/kubernetes-csi/external-snapshotter#csi-external-snapshotter-sidecar-command-line-options
    extraArgs: []
    args:
      # enableVolumeGroupSnapshots enables support for volume group snapshots
      enableVolumeGroupSnapshots: false
  nodeSelector: {}
  tolerations: []
  affinity: {}
selinuxMount: false
storageClass:
  # Specifies whether the Storage class should be created
  create: true
  name: 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: myfs
  fsName: 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: debug
  fuseMountOptions: ""
  # (optional) Comma separated string of Cephfs kernel mount options.
  # Check man mount.ceph for mount options. For eg:
  # kernelMountOptions: readdir_max_bytes=1048576,norbytes
  kernelMountOptions: ""
  # (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: kernel
  mounter: ""
  # (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-secret
  controllerExpandSecretNamespace: ""
  nodeStageSecret: csi-cephfs-secret
  nodeStageSecretNamespace: ""
  reclaimPolicy: Delete
  allowVolumeExpansion: true
  mountOptions:
  # Mount Options
  # Example:
  #mountOptions:
    - discard
secret:
  # Specifies whether the secret should be created
  create: true
  name: csi-cephfs-secret
  annotations: {}
  # 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 class
  userID: cephfs01
  userKey: AQAHRD9mmCOLCBAAb+gJ3WBM/KU/FbZEofGOJg==
  adminID: admin
  adminKey: AQASMz9mgVCqNxAABEAu/WYy0gaEcTC5zC60Ug==
cephconf: |
  [global]
    auth_cluster_required = cephx
    auth_service_required = cephx
    auth_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:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
  storageClassName: 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

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

程序员代码面试指南题目解析(一)

题目一&#xff1a;如何仅用递归函数和栈操作逆序一个栈 题目要求&#xff1a; 一个栈依次压入 1、2、3、4、5&#xff0c;那么从栈顶到栈底分别为5、4、3、2、1。将这个栈 转置后&#xff0c;从栈顶到栈底为 1、2、3、4、5&#xff0c;也就是实现栈中元素的逆序&#xff0c;但…

移动硬盘加了PD充电口给设备供电:未来存储与供电的完美结合

添加图片注释&#xff0c;不超过 140 字&#xff08;可选&#xff09; 一、引言 随着科技的飞速发展&#xff0c;电子设备在人们的日常生活中扮演着越来越重要的角色。与此同时&#xff0c;设备间的互联互通和供电方式的便捷性也成为了用户关注的焦点。移动硬盘&#xff0c;作…

docker的centos容器使用yum报错

错误描述 学习docker过程中&#xff0c;基于 centos 镜像自定义新的镜像。拉取一个Centos镜像&#xff0c;并运行容器&#xff0c;容器安装vim&#xff0c;报错了。 报错&#xff1a;Error: Failed to download metadata for repo appstream: Cannot prepare internal mirror…

【数组算法】598. 区间加法

给你一个 m x n 的矩阵 M 和一个操作数组 op 。矩阵初始化时所有的单元格都为 0 。ops[i] [ai, bi] 意味着当所有的 0 < x < ai 和 0 < y < bi 时&#xff0c; M[x][y] 应该加 1。 在 执行完所有操作后 &#xff0c;计算并返回 矩阵中最大整数的个数 。 示例 1: …

已经安装tensorflow,仍报错No module named ‘tensorflow‘

在安装某些python虚拟环境的教程文章中&#xff0c;经常看到有评论区说安装了但是调用显示无模块&#xff0c;例如pytorch和tensorflow等等。 其实跟之前我写过的一篇文章解决方法类似&#xff0c;就是python项目中需要应用哪个虚拟环境&#xff0c;这个项目的python解释器就选…

C语言----斐波那契数列

各位看官们好&#xff0c;当我写了上一篇博客杨辉三角后&#xff0c;有一些看官叫我讲一下斐波那契数列。对于这个大家应该是有了解的。最简单的规律就是f(n)f(n-2)f(n-1)。就是当前是前两项之和&#xff0c;然后下标1和0都是1.从第三项开始计算的。那么我们知道规律&#xff0…

1.分布式-理论

目录 一、什么是分布式系统 二、CAP理论 1.一致性Consisency 2.可用性(Availability) 3.分区容错性(Partition tolrance) 三、BASE理论 1.Basically Available(基本可用) 2.Soft state&#xff08;软状态&#xff09; 3.Eventually consistent&#xff08;最终一致性&a…

QueryPerformanceCounter实现高精度uS(微妙)延时

参考连接 C# 利用Kernel32的QueryPerformanceCounter封装的 高精度定时器Timer_kernel32.dll queryperformancecounter-CSDN博客https://blog.csdn.net/wuyuander/article/details/111831973 特此记录 anlog 2024年5月11日

matlab的imclose()详解

J imclose(I,SE) J imclose(I,nhood) 说明 J imclose(I,SE) 使用结构元素 SE 对灰度或二值图像 I 执行形态学闭运算。形态学闭运算是先膨胀后腐蚀&#xff0c;这两种运算使用相同的结构元素。 J imclose(I,nhood) 对图像 I 执行闭运算&#xff0c;其中 nhood 是由指定结…

虚表,虚函数习题

6. 关于虚表说法正确的是&#xff08;d &#xff09; A&#xff1a;一个类只能有一张虚表 多重继承 B&#xff1a;基类中有虚函数&#xff0c;如果子类中没有重写基类的虚函数&#xff0c;此时子类与基类共用同一张虚表 即使子类重写了基类的虚函数&#xff0c;此时子类与…

Linux下安装mysql8.0(以rpm包安装)

前言&#xff1a;原文在我的博客网站中&#xff0c;持续更新数通、系统方面的知识&#xff0c;欢迎来访&#xff01; Linux下安装mysql8.0&#xff08;以rpm包安装&#xff09;https://myweb.myskillstree.cn/125.html 目录 1、查操作系统信息 2、下载mysql 8.0.34的rpm包 …

Python基础详解四

一&#xff0c;Json解析 字典转换为JSON&#xff1a; import jsondata [{"name":"袁震","age":20},{"name":"张三","age":21},{"name":"李四","age":22}] str json.dumps(data) …

Zotero 使用入门(笔记)

参考文献&#xff1a;Zotero入门完整教程-共27节-免费&#xff0c;李长太>&#xff0c; 仅供参考学习

【stm32-2】按键控制LED光敏传感器控制蜂鸣器

1.按键控制LED uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); //读取输入数据寄存器某一个端口的输入值 uint16_t GPIO_ReadInputData(GPIO_TypeDef* GPIOx); //读取整个输入数据寄存器 uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDe…

REFORMER: 更高效的TRANSFORMER模型

大型Transformer模型通常在许多任务上都能达到最先进的结果&#xff0c;但是训练这些模型的成本可能会非常高昂&#xff0c;特别是在处理长序列时。我们引入了两种技术来提高Transformer的效率。首先&#xff0c;我们用一种使用局部敏感哈希的点积注意力替换了原来的点积注意力…

攻防世界-web-unseping

题目 知识点 PHP代码审计PHP序列化和反序列化PHP中魔术方法命令执行绕过方式 解读源码 <?php highlight_file(__FILE__);class ease{private $method;private $args;function __construct($method, $args) {$this->method $method;$this->args $args;}function …

【负载均衡式在线OJ项目day6】源文件路由功能及文件版题库构建

一.前言 前文讲到了OJ模块的设计思路&#xff0c;毫无疑问这是一个网络服务&#xff0c;我们先使用httplib&#xff0c;将源文件的路由功能实现&#xff0c;先把框架写好&#xff0c;后续再更改回调方法。 随后计划编写Modify模块&#xff0c;提供增删查改题库的功能(主要是查…

探索生产者/消费者模式:解决并发编程中的资源竞争

序言 在并发编程中&#xff0c;资源竞争是一个常见的问题。为了有效地管理资源并确保线程安全&#xff0c;需要采用一些有效的方法。其中之一是生产者/消费者模式&#xff0c;它是一种经典的并发设计模式&#xff0c;用于解决生产者和消费者之间的协作问题。本文将深入探讨生产…

sentinel-dashborard下发流控规则未生效排查解决

Sentinel简介 Sentinel是阿里巴巴开源的一个流量控制组件&#xff0c;它以流量为切入点&#xff0c;从流量控制、熔断降级、系统负载保护等多个维度来保护服务的稳定性。Sentinel的核心思想是&#xff1a;通过动态设置的规则&#xff0c;对进入系统的流量进行控制&#xff0c;…

【好困】磁场里的瞌睡虫:地磁暴真的会让我们感到疲倦吗?

【好困】磁场里的瞌睡虫&#xff1a;地磁暴真的会让我们感到疲倦吗&#xff1f; 写在最前面地磁暴真的会让我们感到疲倦吗&#xff1f;一探究竟地磁暴是什么&#xff1f;地磁暴如何影响人体&#xff1f;结论 &#x1f308;你好呀&#xff01;我是 是Yu欸 &#x1f30c; 2024每…