TLS setup on K8S Ingress with Traefik

6/19/2018

I have a setup that is not too much different than the user guide for use with k8s. For some reason I can only access http://app.minikube and not https://app.minikube.

Can someone look at my setup and see what I am obviously missing?

apiVersion: v1
kind: Service
metadata:
 name: myapp
 labels:
   app: myapp
spec:
 ports:
 - name: http
   port: 80
   targetPort: 7777
 selector:
   app: myapp
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
 name: myingress
 annotations:
   kubernetes.io/ingress.class: traefik
spec:
 rules:
 - host: app.minikube
   http:
     paths:
     - path: /
       backend:
         serviceName: myapp
         servicePort: http
 tls:
  - secretName: mytls

FYI, according to the Traefik user guide, the hosts definition in tls is unneeded, which is why I left it out.

The field hosts in the TLS configuration is ignored. Instead, the domains provided by the certificate are used for this purpose. It is recommended to not use wildcard certificates as they will match globally)

-- The Brewmaster
https
kubernetes
ssl
traefik

1 Answer

6/19/2018

You're missing the hosts section:

  tls:
  - hosts:
    - my-host.example.com
    secretName: my-secret
-- Tiago Lopo
Source: StackOverflow