在 GKE Elasticsearch 集群上使用 Curator cronjob 配置 Google Cloud Storage 插件

在 GKE Elasticsearch 集群上使用 Curator cronjob 配置 Google Cloud Storage 插件

我在 GKE 上部署了一个 Elasticsearch 集群,并以该项目为起点:https://github.com/pires/kubernetes-elasticsearch-cluster

我想使用 Kubernetes CronJob 对象配置两个 Curator 作业,对索引进行快照,然后删除/修剪旧索引。

我想将快照存储在 GCS 存储桶中。我创建了一个新的服务帐户并下载了 JSON 凭据密钥,以与 elasticsearch 密钥库一起使用。请参阅插件文档:https://www.elastic.co/guide/en/elasticsearch/plugins/current/repository-gcs-usage.html

我不确定如何/在哪里添加此密钥,以供执行备份的 Curator CronJob 使用。Elasticsearch 文档提到运行elasticsearch-keystore凭证密钥文件上的二进制文件。

策展人.yaml:

apiVersion: batch/v1beta1
    kind: CronJob
    metadata:
      name: curator
    spec:
      schedule: 0 11 * * *
      jobTemplate:
        spec:
          template:
            spec:
              containers:
              - name: curator
                image: quay.io/pires/docker-elasticsearch-curator:5.4.1
                args:
                - --config
                - /etc/config/config.yml
                - /etc/config/action_file.yml
                env:
                  - name:
                volumeMounts:
                  - name: config-volume
                    mountPath: /etc/config
              volumes:
                - name: config-volume
                  configMap:
                    name: curator-config
              restartPolicy: OnFailure

curator-config.yaml:

apiVersion: v1
kind: ConfigMap
metadata:
  name: curator-config
data:
  action_file.yml:
    # Remember, leave a key empty if there is no value.  None will be a string,
    # not a Python "NoneType"
    #
    # Also remember that all examples have 'disable_action' set to True.  If you
    # want to use this action as a template, be sure to set this to False after
    # copying it.
    actions:
  1:
    action: snapshot
    options:
      repository: gcs_repository
      name: ${SNAPSHOT_NAME:snapshot-%Y-%m-%d}
      continue_if_exception: false
    filters:
      - filtertype: age
        source: name
        direction: older
        timestring: '%Y-%m-%d'
        unit: days
        unit_count: ${DAYS}
  2:
    action: delete_indices
    options:
      continue_if_exception: false
    filters:
      - filtertype: age
        source: name
        direction: older
        timestring: '%Y-%m-%d'
        unit: days
        unit_count: ${DAYS}

$kubectl 获取 Pod

NAME                                             READY     STATUS    RESTARTS   AGE
cerebro-59648dc47c-vr964                         1/1       Running   0          25d
es-client-7bff44b8f5-2wqcs                       1/1       Running   0          12d
es-client-7bff44b8f5-vnrhg                       1/1       Running   0          12d
es-data-0                                        1/1       Running   0          52d
es-data-1                                        1/1       Running   0          52d
es-data-2                                        1/1       Running   0          52d
es-master-6bf767f949-8fpjl                       1/1       Running   0          52d
es-master-6bf767f949-brjpq                       1/1       Running   0          52d
es-master-6bf767f949-gx2jp                       1/1       Running   0          52d
fluentd-gcp-v2.0-7mncl                           1/1       Running   0          43m
fluentd-gcp-v2.0-rsfmc                           1/1       Running   0          43m
fluentd-gcp-v2.0-tbh9t                           1/1       Running   0          43m
kibana-595858b4b7-5npcr                          1/1       Running   0          52d
nginx-ingress-controller-86c8447687-z4rjq        1/1       Running   2          52d
nginx-ingress-default-backend-6664bc64c9-q2hnm   1/1       Running   338        52d 

相关内容