'ElasticSearch Kubernetes Setup with Skaffold

I love elastic search so on my new project I have been trying to make it work on Kubernetes and skaffold

this is the yaml file I wrote:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: eks-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: eks
  template:
    metadata:
      labels:
        app: eks
    spec:
      containers:
        - name: eks
          image: elasticsearch:7.17.0
---
apiVersion: v1
kind: Service
metadata:
  name: eks-srv
spec:
  selector:
    app: eks
  ports:
    - name: db
      protocol: TCP
      port: 9200
      targetPort: 9200
    - name: monitoring
      protocol: TCP
      port: 9300
      targetPort: 9300

After I run skaffold dev it shows to be working by Kubernetes but after a few seconds it crashes and goes down.

I can't understand what I am doing wrong.

This is where the problem seems to occur

After I have updated my config files as Mr. Harsh Manvar it worked like a charm but currently I am facing another issue. The client side says the following....

Btw I am using ElasticSearch version 7.11.1 and Client side module "@elastic/elasticsearch^7.11.1"

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source