镜像
镜像版本:可以去 https://hub.docker.com/ 搜索镜像,这里用的是elasticsearch:7.17.4
k8s已经存在存储类 (Storage Class):alicloud-disk-ssd
服务发现
apiVersion: v1
kind: Service
metadata:
name: elasticsearch
spec:
clusterIP: None
ports:
- name: elasticsearch-in
port: 9300
protocol: TCP
targetPort: 9300
- name: elasticsearch-out
port: 9200
protocol: TCP
targetPort: 9200
selector:
app: elasticsearch
type: ClusterIP
部署服务
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: elasticsearch
spec:
replicas: 1
selector:
matchLabels:
app: elasticsearch
serviceName: elasticsearch
template:
metadata:
labels:
app: elasticsearch
spec:
containers:
- env:
- name: ES_JAVA_OPTS
value: -Xms2048m -Xmx2048m
- name: node.data
value: "true"
- name: node.master
value: "true"
- name: