Ingress-nginx: Is there an example for accessing https service behind the nginx ingress ????

Created on 5 May 2018  路  11Comments  路  Source: kubernetes/ingress-nginx

Is there an example for accessing https service behind the nginx ingress ????

The accessing a http service behind the nginx ingress example worked as expected !!!
But there was no official https example for ingress kind yaml file or I missed somewhere ??

Most helpful comment

As of the version of "image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.26.1" - Use backend-protocol: HTTPS https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#backend-protocol instead of using secure-backends: true

  annotations:
     kubernetes.io/ingress.class: "nginx"
     nginx.ingress.kubernetes.io/ssl-passthrough: "true"
     nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"

All 11 comments

@aledbf thanks for advise!!

Still have some problem. now I can access the dashboard through http from ingress address . Any way to access it through https from ingress address ????

$ kubectl get ing -n kube-system
NAME                HOSTS                   ADDRESS   PORTS     AGE
dashboard-ingress   dashboard.k8s.ingress             80        1d

$ cat dashboard-ingress-example.yaml 
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: dashboard-ingress
  namespace: kube-system
  annotations:
    nginx.org/ssl-services: "kubernetes-dashboard"
    ingress.kubernetes.io/ssl-passthrough: "true"
    nginx.ingress.kubernetes.io/secure-backends: "true"
spec:
  rules:
  - host: dashboard.k8s.ingress
    http:
      paths:
      - backend:
          serviceName: kubernetes-dashboard
          servicePort: 443

$ kubectl get ing -n kube-system
NAME                HOSTS                   ADDRESS   PORTS     AGE
dashboard-ingress   dashboard.k8s.ingress             80        1d

OSX-GamePC:dashboard whm$ kubectl describe  ing dashboard-ingress   -n kube-system
Name:             dashboard-ingress
Namespace:        kube-system
Address:          
Default backend:  default-http-backend:80 (<none>)
Rules:
  Host                   Path  Backends
  ----                   ----  --------
  dashboard.k8s.ingress  
                            kubernetes-dashboard:443 (10.244.3.6:8443)
Annotations:
  nginx.org/ssl-services:                            kubernetes-dashboard
  ingress.kubernetes.io/ssl-passthrough:             true
  kubectl.kubernetes.io/last-applied-configuration:  {"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"ingress.kubernetes.io/ssl-passthrough":"true","nginx.ingress.kubernetes.io/secure-backends":"true","nginx.org/ssl-services":"kubernetes-dashboard"},"name":"dashboard-ingress","namespace":"kube-system"},"spec":{"rules":[{"host":"dashboard.k8s.ingress","http":{"paths":[{"backend":{"serviceName":"kubernetes-dashboard","servicePort":443}}]}}]}}

  nginx.ingress.kubernetes.io/secure-backends:  true
Events:
  Type    Reason  Age   From                      Message
  ----    ------  ----  ----                      -------
  Normal  UPDATE  12m   nginx-ingress-controller  Ingress kube-system/dashboard-ingress

Thanks @aledbf
My problem fixed.

in my case I had
nginx.ingress.kubernetes.io/secure-backends: "true"
but missed
nginx.org/ssl-services: "kubernetes-dashboard"

which seems also necessary ...

Closing. To access the dashboard using https you need to add a TLS section
Please check https://kubernetes.github.io/ingress-nginx/examples/tls-termination/README/

Any solution for traefik?

Closing. To access the dashboard using https you need to add a TLS section
Please check https://kubernetes.github.io/ingress-nginx/examples/tls-termination/README/

the link is wrong
please corect

As of the version of "image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.26.1" - Use backend-protocol: HTTPS https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#backend-protocol instead of using secure-backends: true

  annotations:
     kubernetes.io/ingress.class: "nginx"
     nginx.ingress.kubernetes.io/ssl-passthrough: "true"
     nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"

Thanks @totocoding ! nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" worked for me!

Was getting the error:

[error] 45438#45438: *209860143 upstream sent no valid HTTP/1.0 header while reading response header from upstream

The above annotation on the Ingress resolved it for me.

@totocoding Many thanks! I have been the whole day looking for this!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cehoffman picture cehoffman  路  3Comments

bashofmann picture bashofmann  路  3Comments

yuyang0 picture yuyang0  路  3Comments

c-mccutcheon picture c-mccutcheon  路  3Comments

cabrinoob picture cabrinoob  路  3Comments