我在 Mac 上使用 Minikube(Podman) 在 Kubernetes 上运行 eck elasticsearch 服务。我可以使用 kubectl 命令从浏览器访问 elasticsearch 实例:
kubectl port-forward service/elasticsearch-sample-es-http 3002:9200
,但我想使用 NodePort 或 Ingress 服务从浏览器访问 elasticsearch。下面是我的elasticsearch yaml文件代码::
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: elasticsearch-sample
spec:
version: 7.15.2
nodeSets:
- name: default
config:
node.store.allow_mmap: false
podTemplate:
metadata:
labels:
app: elastic-search
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
count: 2
http:
service:
spec:
type: NodePort
ports:
- name: https
port: 9200
targetPort: 9200
protocol: TCP
nodePort: 31920```
I tried with both NodePort and Ingress but not able to access the elasticsearch instance.