• Kubernetes——GlusterFS存储卷


    GlusterFS存储卷

      GlusterFS(Gluster File System)是一个开源的分布式文件系统,是水平扩展存储解决方案 Gluster 的核心,具有强大的横向扩展能力,GlusterFS 通过扩展能够支持数 PB 存储容量和处理数千客户端。

      GlusterFS 借助 TCP/IP 或 InfiniBand RDMA 网络将物理分布的存储资源聚集在一起,使用单一全局命名空间来管理数据。另外,GlusterFS 基于可堆叠的用户空间设计,可为各种不同的数据负载提供优异的性能,是另一种流行的分布式解决方案。要配置 Pod 资源使用 GlusterFS 存储卷,需要事先满足以下前提条件。

    1. 存在某可用的 GlusterFS 存储集群。
    2. 在 GlusterFS 集群中创建一个能满足 Pod 资源数据存储需要的卷。
    3. 在 Kubernetes 集群内的各节点上安装 GlusterFS 客户端程序包(glusterfs 和 glusterfs-fuse)。

      另外,若要基于 GlusterFS 使用存储卷的动态供给机制,还需要事先部署 heketi,它用不为 GlusterFS 集群提供 RESTful 风格的管理接口。Gluster 存储集群及heketi 的配置这里忽略。

      定义 Pod 资源使用 GlusterFS 类型存储卷时,字段定义如下:

    [root@mh-k8s-master-247-10 ~]# kubectl explain pod.spec.volumes.glusterfs
    KIND:     Pod
    VERSION:  v1
    
    RESOURCE: glusterfs <Object>
    
    DESCRIPTION:
         Glusterfs represents a Glusterfs mount on the host that shares a pod's
         lifetime. More info: https://examples.k8s.io/volumes/glusterfs/README.md
    
         Represents a Glusterfs mount that lasts the lifetime of a pod. Glusterfs
         volumes do not support ownership management or SELinux relabeling.
    
    FIELDS:
       endpoints	<string> -required-
         EndpointsName is the endpoint name that details Glusterfs topology. More
         info: https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod
    
       path	<string> -required-
         Path is the Glusterfs volume path. More info:
         https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod
    
       readOnly	<boolean>
         ReadOnly here will force the Glusterfs volume to be mounted with read-only
         permissions. Defaults to false. More info:
         https://examples.k8s.io/volumes/glusterfs/README.md#create-a-pod
    
    [root@mh-k8s-master-247-10 ~]# 
    

      常用字段定义如下:

      • endpoints <string>: Endpoints 资源的名称,此资源需要事先存在,用于提供 Gluster 集群的部分节点信息作为其访问入口;必选字段。
      • path <string>: 用到的 GlusterFS 集群的卷路径,如 kube-redis;必选字段。
      • readOnly <boolean>:是否为只读卷。

      下面是一个定义在 vol-glusterfs.yaml 配置文件中的 Pod 资源示例,它使用了 GlusterFS 存储卷持久保存应用数据。它通过 gluster-endpoints 资源中定义的 GlusterFS 集群节点信息接入集群,并以 kube-redis 卷作为 Pod 资源的存储卷。glusterfs-endpoints 资源需要在 Kubernetes 集群中事先创建,而 kube-redis 则需要事先创建于 Gluster 集群。

    apiVersion v1
    kind: Pod
    metadata:
      name: vol-glusterfs-pod
      labels:
        app: redis
    spec:
      containers:
      - name: redis
        image: redis:alpine
    	ports:
    	- containerPort: 6379
    	  name: redisport
    	volumeMounts:
    	- mountPath: /data
    	  name: redisdata
      volumes:
        - name: redis-glusterfs-vol
          glusterfs:
    	    endpoints: glusterfs-endpoints
    		path: kube-redis
    		readOnly: false
    
    apiVsersion: v1
    kind: Endpoints
    metadata:
      name: glusterfs-endpoints
    subsets:
      - addresses:
        - ip: gfs01.xxx.com
    	ports:
    	- port: 24007
    	  name: glusterd
      -addresses:
        - ip: gfs02.xxx.com
        ports:
    	- port: 24007
    	  name: glusterd
      -addresses:
        - ip: gfs03.xxx.com
        ports:
    	- port: 24007
    	  name: glusterd
  • 相关阅读:
    首发Zend Studio 9.0.2正式版注册破解
    PHP 中Cookie和Session的使用
    PHP设计模式职责和单例模式
    软件工程工具学习(1)Visio
    java复习(4)数字处理类
    java复习(1)java与C++区别
    微信开发(1)微信防撤回功能实现
    java复习(3)字符串、数组
    java复习(2)java基础杂记
    java复习(5)接口、继承、多态
  • 原文地址:https://www.cnblogs.com/zuoyang/p/16407792.html
Copyright © 2020-2023  润新知