kind: Service
apiVersion: v1
metadata:
  name: elasticsearch
  namespace: logging
  labels:
    app: elasticsearch
spec:
  selector:
    app: elasticsearch
  # clusterIP=None将服务设置为无头服务
  clusterIP: None
  ports:
    # 9200端口用来与REST API交互
    - port: 9200
      name: rest
    # 9300用于节点间通信
    - port: 9300
      name: inter-node