<p>I have a k8s cluster on which i have deployed ELK my kibana deployment and service looks like</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    service: kibana
  name: kibana
spec:
  replicas: 1
  selector:
    matchLabels:
      service: kibana
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        service: kibana
    spec:
      containers:
        - image: docker.elastic.co/kibana/kibana:6.6.0
          name: kibana
          ports:
            - containerPort: 5601
          resources:
            requests:
              memory: 1Gi
            limits:
              memory: 1Gi
      restartPolicy: Always
      imagePullSecrets:
        - name: regcred
---
apiVersion: v1
kind: Service
metadata:
  labels:
    service: kibana
  name: kibana
spec:
  ports:
    - name: "5601"
      port: 5601
      targetPort: 5601
  selector:
    service: kibana
  type: NodePort
</code></pre>

<p>and the nginx ingress looks like</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: loadbalancer-https
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: true
    nginx.ingress.kubernetes.io/force-ssl-redirect: true
    nginx.ingress.kubernetes.io/secure-backends: "true"
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/app-root: /
    nginx.org/ssl-services: "kibana"
    kubernetes.io/ingress.class: nginx
spec:
  tls:
    - hosts:
        - kibana.some.com
      secretName: secret
  rules:
    - host: kibana.some.com
      http:
        paths:
          - path: /
            backend:
              serviceName: kibana
              servicePort: 5601
</code></pre>

<p>But i get 502 Bad Gateway and if i look on the nginx ingress logs i see </p>

<pre><code>2019/03/02 01:25:09 [error] 875#875: *470787 upstream prematurely closed connection while reading response header from upstream, client: 10.138.82.98, server: kibana.some.com, request: "GET /favicon.ico HTTP/2.0", upstream: "http://10.244.2.86:5601/favicon.ico", host: "kibana.some.com", referrer: "https://kibana.some.com/"
</code></pre>

<p>It seems pretty straightforward but i don't know what im missing here. I would appreciate some help.</p>

<p>Thanks</p>

bitgandtter
<p>It should be related to your <code>nginx.ingress.kubernetes.io/secure-backends: "true"</code> configuration in your ingress. Did you configure HTTPS/TLS support for your Kibana in Pod? Otherwise I would suggest removing this annotation.</p>

<p>Also, please note that <code>nginx.ingress.kubernetes.io/secure-backends: "true"</code> annotation is deprecated.</p>

<p>Ref: </p>

<ul>
<li><a href="https://docs.giantswarm.io/guides/advanced-ingress-configuration/" rel="nofollow noreferrer">https://docs.giantswarm.io/guides/advanced-ingress-configuration/</a></li>
<li><a href="https://github.com/kubernetes/ingress-nginx/issues/3416" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-nginx/issues/3416</a></li>
</ul>
