我使用了来自官方弹性存储库的eck-操作符(与eck-运算符-crd),https://artifacthub.io/packages/helm/elastic/eck-operator、Kibana和Elasticsearch清单都在部署并正常工作。我的问题是如何配置其他特性,如:索引生命周期策略、Kibana数据视图、新模板、数据流、仪表板等?我看到很少有运营者有某种清单,但没有从上面提到。谢谢你的评论。
发布于 2022-08-04 15:18:38
我们通过配置映射来实现这一点。我们将索引模板和索引生命周期策略存储为json格式。此外,执行脚本是配置映射的一部分,它通过POST将索引模板和ilm策略推送到elasticsearch。因为现在所有的内容都在卷中,所以我们创建了一个cron作业来执行这个脚本。
例如,这是索引模板--所有的指示语. this:
{
"index_patterns": ["abc*"],
"priority": 300,
"composed_of": ["template1", "template2"],
"version": 3
}execution-script.sh
curl -XPUT "http://some_url:9200/_index_template/all-indices" -H 'Content-Type: application/json' -d @/etc/elasticsearch-templates/all-indices.json 我们从terraform创建这些配置映射。
kibana.yaml
...
podTemplate:
spec:
containers:
- name: kibana
volumeMounts:
- name: elasticsearch-templates
mountPath: /etc/elasticsearch-templates
readOnly: true
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "sleep 15 && sh /etc/elasticsearch-templates/execution-script.sh"]
volumes:
- name: elasticsearch-templates
configMap:
name: ilm-and-index-templates然后cron作业执行脚本。
apiVersion: batch/v1
kind: CronJob
metadata:
name: script-execution
spec:
schedule: "0 5 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: script-execution
image: alpine/curl:latest
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- sh /etc/elasticsearch-templates/execution-script.sh
volumeMounts:
- name: elasticsearch-templates
mountPath: /etc/elasticsearch-templates
readOnly: true
restartPolicy: OnFailure
volumes:
- name: elasticsearch-templates
configMap:
name: ilm-and-index-templateshttps://stackoverflow.com/questions/73142552
复制相似问题