how ingress decides whether he has to expose kubernetes service on http or https?

2/13/2019

I have setup strapi on kubernetes, everything is running fine but when I am trying to hit APIs exposed by strapi from my frontend application, which is running on HTTPs I am getting an error as Kubernetes ingress has exposed strapi on HTTP. I am clueless how to configure strapi for HTTPS request. I would be glad if someone could guide me.

-- Rajat Badjatya
docker
https
kubernetes
kubernetes-ingress
strapi

1 Answer

2/14/2019

Basically Ingress provides different mechanisms of TLS termination.

If your frontend application can handle https, you should just route the tls traffic to the respective service. If your frontend application has no tls capabilities, you should use ingress https termination. https://kubernetes.io/docs/concepts/services-networking/ingress/

http:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /testpath
        backend:
          serviceName: test
          servicePort: 80

Example https config from kubernetes, how it would look if your service does not do https:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: frontend-application-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  tls: 
  - hosts: 
    - mydomain.com
    secretName: mycertificate
  rules:
  - host: mydomain.com
    https:
      paths:
      - path: /
        backend:
          serviceName: frontend-application
          servicePort: http
-- LeonG
Source: StackOverflow