简体中文版经机器翻译而成,仅供参考。如与英语版出现任何冲突,应以英语版为准。

设置Astra数据存储组件

你先请 "安装了独立的Astra数据存储库" 并解决了一些问题 "环境前提条件"、您将安装Astra Trident、配置Kubernetes快照功能、设置存储后端并创建默认存储类:

注 如果您使用Astra控制中心部署Astra数据存储、则无需执行这些步骤、除非您打算进行设置 其他监控选项

安装 Astra Trident

对于Astra数据存储、您需要安装Astra Trident 21.10.1或更高版本。您可以使用以下选项之一安装 Astra Trident :

安装 Kubernetes Snapshot CRD 和控制器

要创建永久性卷声明( PVC )快照,需要使用 Kubernetes Snapshot CRC 和控制器。如果尚未为您的环境安装 CRD 和控制器,请运行以下命令进行安装。

注 以下命令示例假设 ` /trident` 作为目录;但是,您使用的目录可以是用于下载 YAML 文件的任何目录。
您需要什么? #8217 ;将需要什么
步骤
  1. 应用 snapshot.storage.k8s.io_volumesnapshotclasses.yaml :

    kubectl apply -f trident/snapshot.storage.k8s.io_volumesnapshotclasses.yaml

    响应:

    customresourcedefinition.apiextensions.k8s.io/volumesnapshotclasses.snapshot.storage.k8s.io configured
  2. 应用 snapshot.storage.k8s.io_volumesnapshotcontents.yaml :

    kubectl apply -f trident/snapshot.storage.k8s.io_volumesnapshotcontents.yaml

    响应:

    customresourcedefinition.apiextensions.k8s.io/volumesnapshotcontents.snapshot.storage.k8s.io configured
  3. 应用 snapshot.storage.k8s.io_volumesnapshots.yaml :

    kubectl apply -f trident/snapshot.storage.k8s.io_volumesnapshots.yaml

    响应:

    customresourcedefinition.apiextensions.k8s.io/volumesnapshots.snapshot.storage.k8s.io configured
  4. 应用 setup-snapshot-controller.yaml :

    kubectl apply -f trident/setup-snapshot-controller.yaml

    响应:

    deployment.apps/snapshot-controller configured
  5. 应用 rbac 快照控制器 .yaml :

    kubectl apply -f trident/rbac-snapshot-controller.yaml

    响应:

    serviceaccount/snapshot-controller configured
    clusterrole.rbac.authorization.k8s.io/snapshot-controller-runner configured
    clusterrolebinding.rbac.authorization.k8s.io/snapshot-controller-role configured
    role.rbac.authorization.k8s.io/snapshot-controller-leaderelection configured
    rolebinding.rbac.authorization.k8s.io/snapshot-controller-leaderelection configured
  6. 验证是否已应用 CRD YAML 文件:

    kubectl get crd | grep volumesnapshot

    响应示例:

    astradsvolumesnapshots.astrads.netapp.io              2021-08-04T17:48:21Z
    volumesnapshotclasses.snapshot.storage.k8s.io         2021-08-04T22:05:49Z
    volumesnapshotcontents.snapshot.storage.k8s.io        2021-08-04T22:05:59Z
    volumesnapshots.snapshot.storage.k8s.io               2021-08-04T22:06:17Z
  7. 验证是否已应用快照控制器文件:

    kubectl get pods -n kube-system | grep snapshot

    响应示例:

    snapshot-controller-7f58886ff4-cdh78                                    1/1     Running   0          13s
    snapshot-controller-7f58886ff4-tmrd9                                    1/1     Running   0          32s

将 Astra 数据存储设置为存储后端

在 ads_backend.json 文件中配置存储后端参数,并创建 Astra Data Store 存储后端。

步骤
  1. 使用安全终端创建 ads_backend.json

    vi ads_backend.json
  2. 配置 JSON 文件:

    注 以下步骤将提供一个JSON示例。
    1. 将 ` "cluster"` 值更改为 Astra Data Store 集群的集群名称。

    2. 将 ` "namespace"` 值更改为要用于创建卷的命名空间。

    3. 将 ` "autoExportPolicy"` 值更改为 true ,除非为此后端设置了 exportpolicy CR 。

    4. 使用要授予访问权限的 IP 地址填充 ` "autosExportCIDRs"` 列表。使用 0.0.0.0/0 允许所有。

    5. 对于 ` "kubeconfig"` 值,请执行以下操作:

      1. 将 .Kube/config YAML 文件转换为不含空格的 JSON 格式并将其最小化:

        转换示例:

        python3 -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=None)' < ~/.kube/config > kubeconf.json
      2. 编码为 base64 ,并使用 base64 输出作为 ` "kubeconfig"` 值:

        示例编码:

      cat kubeconf.json | base64 | tr -d '\n'
    {
        "version": 1,
        "storageDriverName": "astrads-nas",
        "storagePrefix": "",
        "cluster": "example-1234584",
        "namespace": "astrads-system",
        "autoExportPolicy": true,
        "autoExportCIDRs": ["0.0.0.0/0"],
        "kubeconfig": "<base64_output_of_kubeconf_json>",
        "debugTraceFlags": {"method": true, "api": true},
        "labels": {"cloud": "on-prem", "creator": "trident-dev"},
        "defaults": {
            "qosPolicy": "silver"
        },
        "storage": [
            {
                "labels": {
                    "performance": "extreme"
                },
                "defaults": {
                    "qosPolicy": "gold"
                }
            },
            {
                "labels": {
                    "performance": "premium"
                },
                "defaults": {
                    "qosPolicy": "silver"
                }
            },
            {
                "labels": {
                    "performance": "standard"
                },
                "defaults": {
                    "qosPolicy": "bronze"
                }
            }
        ]
    }
  3. 更改为下载 Trident 安装程序的目录:

    cd <trident-installer or path to folder containing tridentctl>
  4. 创建存储后端:

    ./tridentctl create backend -f ads_backend.json -n trident

    响应示例:

    +------------------+----------------+--------------------------------------+--------+---------+
    |       NAME       | STORAGE DRIVER |                 UUID                 | STATE  | VOLUMES |
    +------------------+----------------+--------------------------------------+--------+---------+
    | example-1234584  | astrads-nas    | 2125fa7a-730e-43c8-873b-6012fcc3b527 | online |       0 |
    +------------------+----------------+--------------------------------------+--------+---------+

创建默认的 Astra Data Store 存储类

创建 Astra Trident 默认存储类并将其应用于存储后端。

步骤
  1. 创建 trident CSI 存储类:

    1. 创建 ads_sc_example.yaml :

      vi ads_sc_example.yaml

      示例

      allowVolumeExpansion: true
      apiVersion: storage.k8s.io/v1
      kind: StorageClass
      metadata:
        creationTimestamp: "2022-05-09T18:05:21Z"
        name: ads-silver
        resourceVersion: "3361772"
        uid: lo023456-da4b-51e3-b430-3aa1e3bg111a
      mountOptions:
      - vers=4
      parameters:
        backendType: astrads-nas
        selector: performance=premium
      provisioner: csi.trident.netapp.io
      reclaimPolicy: Delete
      volumeBindingMode: Immediate
    2. 创建 trident CSI :

      kubectl create -f ads_sc_example.yaml

      响应:

    storageclass.storage.k8s.io/trident-csi created
  2. 验证是否已添加存储类:

    kubectl get storageclass

    响应:

    NAME          PROVISIONER             RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
    ads-silver    csi.trident.netapp.io   Delete          Immediate           true                   6h29m
  3. 更改为下载 Trident 安装程序的目录:

    cd <trident-installer or path to folder containing tridentctl>
  4. 验证 Astra Trident 后端是否已使用默认存储类参数进行更新:

    ./tridentctl get backend -n trident -o yaml

    响应示例:

    items:
    - backendUUID: 2125fa7a-730e-43c8-873b-6012fcc3b527
      config:
        autoExportCIDRs:
        - 0.0.0.0/0
        autoExportPolicy: true
        backendName: ""
        cluster: example-1234584
        credentials: null
        debug: false
        debugTraceFlags:
          api: true
          method: true
        defaults:
          exportPolicy: default
          qosPolicy: bronze
          size: 1G
          snapshotDir: "false"
          snapshotPolicy: none
        disableDelete: false
        kubeconfig: <ID>
        labels:
          cloud: on-prem
          creator: trident-dev
        limitVolumeSize: ""
        namespace: astrads-system
        nfsMountOptions: ""
        region: ""
        serialNumbers: null
        storage:
        - defaults:
            exportPolicy: ""
            qosPolicy: gold
            size: ""
            snapshotDir: ""
            snapshotPolicy: ""
          labels:
            performance: extreme
          region: ""
          supportedTopologies: null
          zone: ""
        - defaults:
            exportPolicy: ""
            qosPolicy: silver
            size: ""
            snapshotDir: ""
            snapshotPolicy: ""
          labels:
            performance: premium
          region: ""
          supportedTopologies: null
          zone: ""
        - defaults:
            exportPolicy: ""
            qosPolicy: bronze
            size: ""
            snapshotDir: ""
            snapshotPolicy: ""
          labels:
            performance: standard
          region: ""
          supportedTopologies: null
          zone: ""
        storageDriverName: astrads-nas
        storagePrefix: ""
        supportedTopologies: null
        version: 1
        zone: ""
      configRef: ""
      name: example-1234584
      online: true
      protocol: file
      state: online
      storage:
        example-1234584_pool_0:
          name: example-1234584_pool_0
          storageAttributes:
            backendType:
              offer:
              - astrads-nas
            clones:
              offer: true
            encryption:
              offer: false
            labels:
              offer:
                cloud: on-prem
                creator: trident-dev
                performance: extreme
            snapshots:
              offer: true
          storageClasses:
          - trident-csi
          supportedTopologies: null
        example-1234584_pool_1:
          name: example-1234584_pool_1
          storageAttributes:
            backendType:
              offer:
              - astrads-nas
            clones:
              offer: true
            encryption:
              offer: false
            labels:
              offer:
                cloud: on-prem
                creator: trident-dev
                performance: premium
            snapshots:
              offer: true
          storageClasses:
          - trident-csi
          supportedTopologies: null
        example-1234584_pool_2:
          name: example-1234584_pool_2
          storageAttributes:
            backendType:
              offer:
              - astrads-nas
            clones:
              offer: true
            encryption:
              offer: false
            labels:
              offer:
                cloud: on-prem
                creator: trident-dev
                performance: standard
            snapshots:
              offer: true
          storageClasses:
          - ads-silver
          supportedTopologies: null
      volumes: []

配置Astra数据存储监控

(可选)您可以配置Astra数据存储以供其他遥测服务监控。如果您不使用Astra控制中心进行Astra数据存储监控、或者希望将监控扩展到其他端点、则建议使用此操作步骤。

如果您的Astra数据存储实例是独立部署、使用Cloud Insights 监控遥测或将日志流式传输到Elastic等第三方端点、则可以安装监控操作员。

注 对于Astra控制中心部署、监控操作员会自动进行配置。您可以跳过以下操作步骤 的前两个命令。

在设置监控之前、您需要在`astrads-system`命名空间中有一个活动的Astra数据存储集群。

步骤
  1. 运行此安装命令:

    kubectl apply -f ./manifests/monitoring_operator.yaml
  2. 配置用于监控的Astra数据存储:

    kubectl astrads monitoring -n netapp-monitoring -r [YOUR REGISTRY] setup
  3. 配置Astra数据存储以将EMS日志流式传输到弹性端点:

    kubectl astrads monitoring es --port <portname> --host <hostname>