提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
文章目录
前言
之前写了eck2.4部署es+kibana,默认的话是https协议的,这里写一个使用http协议的配置。
参考文章:链接: Kubernetes基于ECK部署elasticsearch8.8集群
首先按照https的部署方式部署crd和operator。
链接: k8s使用ECK(2.4)形式部署elasticsearch+kibana
一、准备elasticsearch-cluster.yaml
yaml
#创建namespace
apiVersion: v1
kind: Namespace
metadata:
name: daxinxindahaohao
---
#快速启动es集群
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: quickstart
namespace: daxinxindahaohao
spec:
version: 8.7.1
nodeSets:
- name: default
count: 1
config:
cluster.name: elasticsearch
node.store.allow_mmap: false
# 打开跨域访问
http.cors.enabled: true
http.cors.allow-origin: "*"
# 关闭https访问
xpack.security.enabled: false
xpack.security.http.ssl.enabled: false
podTemplate:
spec:
containers:
- name: elasticsearch
env:
# 修改探针访问方式为http
- name: READINESS_PROBE_PROTOCOL
value: http
---
#增加专属的service,不修改quickstart已有的service
kind: Service
apiVersion: v1
metadata:
name: quickstart-es-internal-http-nodeport
namespace: daxinxindahaohao
labels:
common.k8s.elastic.co/type: elasticsearch
elasticsearch.k8s.elastic.co/cluster-name: quickstart
spec:
ports:
- name: http
protocol: TCP
port: 9200
targetPort: 9200
nodePort: 30806
selector:
common.k8s.elastic.co/type: elasticsearch
elasticsearch.k8s.elastic.co/cluster-name: quickstart
type: NodePort
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
internalTrafficPolicy: Cluster
---
增加了跨域的配置
http.cors.enabled: true
http.cors.allow-origin: "*"
增加了关闭https的配置
xpack.security.enabled: false
xpack.security.http.ssl.enabled: false
增加了探针的http协议
name: READINESS_PROBE_PROTOCOL
value: http
二、部署并测试
总结
使用http的话,要关闭es的https配置,同时还要把探针的协议修改掉。要不探针会报错。