TLS setup on K8S Ingress with Traefik

时间:2018-06-19 08:23:22

标签: ssl https kubernetes traefik

I have a setup that is not too much different than the user guide与k8s一起使用。出于某种原因,我只能访问http://app.minikube而不是https://app.minikube

有人可以查看我的设置,看看我显然缺少什么吗?

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

仅供参考,根据Traefik user guidehosts中的tls定义是不必要的,这就是我将其删除的原因。

  

忽略TLS配置中的字段主机。相反,证书提供的域用于此目的。建议不要使用通配符证书,因为它们将全局匹配)

1 个答案:

答案 0 :(得分:0)

您错过了hosts部分:

  tls:
  - hosts:
    - my-host.example.com
    secretName: my-secret