openssl req \
-newkey rsa:2048 -nodes -keyout tls.key \
-x509 -days 3650 -out tls.crt
kubectl create secret tls traefik-cert --cert=tls.crt --key=tls.key -n lizhe
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: whoingressroute2
namespace: lizhe
spec:
entryPoints:
- websecure
routes:
- match: Host(`who.lizhe.com`)
kind: Rule
services:
- name: whoami
port: 80
sticky:
cookie:
httpOnly: false
name: lizhetoken
tls:
secretName: traefik-cert
如果你打算使用 traefik自带的 default cert 可以使用
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: whoingressroute2
namespace: lizhe
spec:
entryPoints:
- websecure
routes:
- match: Host(`who.lizhe.com`)
kind: Rule
services:
- name: whoami
port: 443
sticky:
cookie:
httpOnly: false
name: lizhetoken
tls:
certResolver: default
options: {}