<p>I'm using <strong>ECK 1.5.0</strong> and I have to use Ingress to expose Elasticsearch. But I'm getting a 502 gateway when I go to the url (<code>http://my-db-url.com</code>). I have confirmed the database is running fine and able to collect / display data.</p>
<p>I was only able to find solutions to exposing Kibana with Ingress on the web but those were not working for me.</p>
<p>Heres my elasticsearch.yaml (contains Elasticsearch object and Ingress object):</p>
<pre><code>apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: my-db
spec:
  version: 7.12.0
  volumeClaimDeletePolicy: DeleteOnScaledownOnly
  nodeSets:
  - name: default
    count: 3
    config:
      node.store.allow_mmap: false
    volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 10Gi
        storageClassName: longhorn

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-db-ingress
  namespace: my-namespace
  annotations:
    nginx.ingress.kubernetes.io/proxy-connect-timeout: &quot;300&quot;
    nginx.ingress.kubernetes.io/upstream-vhost: &quot;$http_host&quot;
spec:
  rules:
    - host: my-db-url.com
      http:
        paths:
          - backend:
              serviceName: my-db-es-http
              servicePort: 9200
</code></pre>

<p>Turns out the same question was asked here: https://discuss.elastic.co/t/received-plaintext-http-traffic-on-an-https-channel-closing-connection/271380</p>
<p>and the solution is to force HTTPS using annotations, which for the nginx ingress controller can be found here: <a href="https://github.com/elastic/helm-charts/issues/779#issuecomment-781431675" rel="nofollow noreferrer">https://github.com/elastic/helm-charts/issues/779#issuecomment-781431675</a></p>
