I am trying to deploy elasticsearch to AKS with a loadbalancer.
What I am struggling to achieve is to have a load balancer that only directs traffic to my client nodes.
This is what I have:
ElasticSearch dployment YAML:
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: quickstart
spec:
version: 7.16.2
nodeSets:
# 3 dedicated master nodes
- name: master
count: 3
podTemplate:
spec:
initContainers:
- name: sysctl
securityContext:
privileged: true
command: ['sh', '-c', 'sysctl -w vm.max_map_count=262144']
config:
node.roles: ["master"]
#node.remote_cluster_client: false
# 3 ingest-data nodes
- name: ingest-data
count: 3
podTemplate:
spec:
initContainers:
- name: sysctl
securityContext:
privileged: true
command: ['sh', '-c', 'sysctl -w vm.max_map_count=262144']
config:
node.roles: ["data", "ingest"]
# 3 client nodes
- name: client
count: 3
podTemplate:
spec:
initContainers:
- name: sysctl
securityContext:
privileged: true
command: ['sh', '-c', 'sysctl -w vm.max_map_count=262144']
config:
node.roles: []
Load Balancer YAML:
apiVersion: v1
kind: Service
metadata:
name: ingress-controller
spec:
type: LoadBalancer
ports:
- name: http
port: 9200
targetPort: 9200
protocol: TCP
selector:
elasticsearch.k8s.elastic.co/cluster-name: "quickstart"
elasticsearch.k8s.elastic.co/node-master: "false"
elasticsearch.k8s.elastic.co/node-data: "false"
elasticsearch.k8s.elastic.co/node-ingest: "false"
elasticsearch.k8s.elastic.co/node-ml: "false"
elasticsearch.k8s.elastic.co/node-transform: "false"
Output of kubectl get svc ingress-controller
(public ip redacted)
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-controller LoadBalancer 10.0.221.180 20.0.0.95 9200:32360/TCP 54m
This loadbalancer does not repond with anything on port 9200 so I suspect its not working anyway but I am not sure how to achieve what im trying to do at all.
Thankyou in advance. I appriciate any tips on how to solve this.