Hello,World

elasticsearch:7.17.7在K8s中集群节点部署无法发现问题?

Elasticsearch | 作者 JayLeo | 发布于2022年11月19日 | 阅读数:2223

版本使用elasticsearch:7.17.7在K8S集群中搭建elasticsearch集群,采用无头服务
配置discovery.seed_hosts无法加入集群,集群内节点随机ip,没有找到相关配置的方法
请大神指教
apiVersion: v1
kind: Service
metadata:
namespace: es-cluster
name: elasticsearch-headless
labels:
app: elasticsearch
spec:
selector:
app: elasticsearch
clusterIP: None
ports:
- port: 9200
name: rest
protocol: TCP
- port: 9300
name: inter-node
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
namespace: es-cluster
name: elasticsearch-svc
labels:
app: elasticsearch
spec:
selector:
app: elasticsearch
type: NodePort
ports:
- port: 9200
nodePort: 30010
targetPort: 9200
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: es-cluster
namespace: es-cluster
labels:
app: elasticsearch
spec:
serviceName: elasticsearch
replicas: 3
selector:
matchLabels:
app: elasticsearch
template:
metadata:
labels:
app: elasticsearch
spec:
initContainers:
- name: permissions
image: busybox:latest
command: ["sh", "-c", "chown -R 1000:1000 /usr/share/elasticsearch/data"]
securityContext:
privileged: true
volumeMounts:
- name: data
mountPath: /usr/share/elasticsearch/data
- name: increase-vm-max-map
image: busybox:latest
command: ["sysctl", "-w", "vm.max_map_count=262144"]
securityContext:
privileged: true
- name: increase-fd-ulimit
image: busybox:latest
command: ["sh", "-c", "ulimit -n 65536"]
securityContext:
privileged: true

containers:
- name: elasticsearch
image: elasticsearch:7.17.7
resources:
limits:
cpu: 1000m
requests:
cpu: 100m
ports:
- containerPort: 9200
name: rest
protocol: TCP
- containerPort: 9300
name: inter-node
protocol: TCP
volumeMounts:
- name: data
mountPath: /usr/share/elasticsearch/data
env:
- name: TZ
value: Asia/Shanghai
- name: cluster.name
value: es-cluster
- name: node.name
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: node.master
value: "true"
- name: node.data
value: "true"
- name: discovery.zen.minimum_master_nodes
value: "2"
- name: discovery.seed_hosts
value: "es-cluster-0.elasticsearch,es-cluster-1.elasticsearch,es-cluster-2.elasticsearch"
- name: cluster.initial_master_nodes
value: "es-cluster-0,es-cluster-1,es-cluster-2"
- name: ingest.geoip.downloader.enabled
value: "false"
- name: ES_JAVA_OPTS
value: "-Xms1g -Xmx1g"
- name: http.cors.enabled
value: "true"
- name: http.cors.allow-origin
value: "*"
- name: network.host
value: "0.0.0.0"
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "local-storage"
resources:
requests:
storage: 1Gi
已邀请:

要回复问题请先登录注册