apiVersion: apps/v1
kind: Deployment
metadata:
name: eks-deploy
spec:
replicas: 1
selector:
matchLabels:
app: eks
template:
metadata:
labels:
app: eks
spec:
containers:
- name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:7.11.1
---
apiVersion: v1
kind: Service
metadata:
name: eks-srv
spec:
selector:
app: eks
ports:
- name: eks-db
protocol: TCP
port: 9200
targetPort: 9200
I use this code for setting up Elastic Search for my project through skaffold. But when I try to connect to the elastic search running on port 9200 it gives me back an error that the connection has been refused.
const client: NewTypes = new Client({
node: 'http://localhost:9200'
})
interface Source {
foo: string
}
const request: estypes.IndexRequest<Source> = {
index: 'test',
body: {
foo: 'bar'
}
}
await client.index(request);
What am I doing wrong?