Describe the bug
I created a web portal and it is working perfectly in Kubernetes with loadbalancer over https protocol. But when i tried to run it with ingress it starts to land on bad gateway page.
Additional information
the application is developed in Dotnet core and running over SSL
Error
2019/08/21 00:43:52 [error] 2482#2482: *12858220 upstream prematurely closed connection while reading response header from upstream, client: 10.240.0.35, server: _, request: "GET / HTTP/1.1", upstream: "http://10.240.0.89:443/", host: "104.211.42.151"
2019/08/21 00:43:52 [error] 2482#2482: *12858220 upstream prematurely closed connection while reading response header from upstream, client: 10.240.0.35, server: _, request: "GET / HTTP/1.1", upstream: "http://10.240.0.89:443/", host: "104.211.42.151"
10.240.0.35 - [10.240.0.35] - - [21/Aug/2019:00:43:52 +0000] "GET / HTTP/1.1" 502 163 "-" "Mozilla/5.0 zgrab/0.x" 111 0.013 [dev-tt-core-web-service-dev-443] [] 10.240.0.89:443, 10.240.0.89:443, 10.240.0.89:443 0, 0, 0 0.008, 0.004, 0.000 502, 502, 502 ccf2d756c46535a0a80c0c62dc1a86cb
2019/08/21 01:03:59 [error] 2482#2482: *12867387 upstream prematurely closed connection while reading response header from upstream, client: 10.240.0.66, server: _, request: "GET / HTTP/1.1", upstream: "http://10.240.0.89:443/", host: "104.211.42.151"
2019/08/21 01:03:59 [error] 2482#2482: *12867387 upstream prematurely closed connection while reading response header from upstream, client: 10.240.0.66, server: _, request: "GET / HTTP/1.1", upstream: "http://10.240.0.89:443/", host: "104.211.42.151"
2019/08/21 01:03:59 [error] 2482#2482: *12867387 upstream prematurely closed connection while reading response header from upstream, client: 10.240.0.66, server: _, request: "GET / HTTP/1.1", upstream: "http://10.240.0.89:443/", host: "104.211.42.151"
10.240.0.66 - [10.240.0.66] - - [21/Aug/2019:01:03:59 +0000] "GET / HTTP/1.1" 502 163 "-" "-" 40 0.011 [dev-tt-core-web-service-dev-443] [] 10.240.0.89:443, 10.240.0.89:443, 10.240.0.89:443 0, 0, 0 0.004, 0.004, 0.004 502, 502, 502 481f9a4bb57bb350e2d5d3b1470e81a5
10.240.0.66 - [10.240.0.66] - - [21/Aug/2019:01:08:30 +0000] "GET / HTTP/1.0" 308 177 "-" "Mozilla/5.0 (compatible; Nimbostratus-Bot/v1.3.2; http://cloudsystemnetworks.com)" 126 0.000 [dev-tt-core-web-service-dev-443] [] - - - - e5d0b03c1c3455b0c479241fdebab7eb
10.240.0.35 - [10.240.0.35] - - [21/Aug/2019:01:35:25 +0000] "GET / HTTP/1.1" 308 177 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" 185 0.000 [dev-tt-core-web-service-dev-443] [] - - - - 3ae81586046173ec8d4ce27b0a2d71bb
10.240.0.35 - [10.240.0.35] - - [21/Aug/2019:02:03:21 +0000] "GET / HTTP/1.1" 308 177 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101 Firefox/47.0" 176 0.000 [dev-tt-core-web-service-dev-443] [] - - - - 9f71a08c389b7b5543ce46d002d45b80
10.240.0.66 - [10.240.0.66] - - [21/Aug/2019:02:20:54 +0000] "GET / HTTP/1.1" 308 177 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36" 186 0.000 [dev-tt-core-web-service-dev-443] [] - - - - f0e578a97920d4e0cd096e61e8bf8d02
10.240.0.66 - [10.240.0.66] - - [21/Aug/2019:03:24:24 +0000] "GET / HTTP/1.1" 308 177 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7" 192 0.000 [dev-tt-core-web-service-dev-443] [] - - - - f94895e5d2b56bc6f717cbda141dd34a
10.240.0.66 - [10.240.0.66] - - [21/Aug/2019:04:24:01 +0000] "GET / HTTP/1.1" 308 177 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36" 186 0.000 [dev-tt-core-web-service-dev-443] [] - - - - 75fa9dd1ef82ef5a91df35b3395cddc1
10.240.0.4 - [10.240.0.4] - - [21/Aug/2019:05:13:08 +0000] "GET / HTTP/1.1" 308 177 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36" 185 0.000 [dev-tt-core-web-service-dev-443] [] - - - - f1840a4204a6adcd66d94b9ba8b766f4
W0821 05:15:00.971912 6 controller.go:878] Service "dev/tt-core-web-service-dev" does not have any active Endpoint.
yaml files
The following is my portal,portal service and ingress YAML respectively:
portal yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: tt-core-web
name: tt-core-web
spec:
replicas: 1
template:
metadata:
labels:
app: tt-core-web
spec:
containers:
- image: webportalcore:latest
name: webportal
imagePullPolicy: Always
ports:
- containerPort: 443
env:
- name: ASPNETCORE_ENVIRONMENT
value: dev
poral service yamlapiVersion: v1
kind: Service
metadata:
name: tt-core-web-service-dev
spec:
type: ClusterIP
selector:
app: tt-core-web
ports:
- port: 443
protocol: TCP
targetPort: 443
ingress yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-service
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- http:
paths:
- path: /
backend:
serviceName: tt-core-web-service-dev
servicePort: 443
- path: /api/
backend:
serviceName: tt-core-web-service-dev
servicePort: 443
- path: /api/
backend:
serviceName: tt-core-web-service-dev
servicePort: 443
Please help me to solve this error
Closing. You need to add the annotation https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#backend-protocol to indicate your application is expecting an HTTPS connection
Most helpful comment
Closing. You need to add the annotation https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#backend-protocol to indicate your application is expecting an HTTPS connection