I'm trying to setting http to https redirection in k8s Ingress. Traefik document is hard to apply to k8s.
I want to apply routers for HTTP & HTTPS
section in this document
I found redirect configuration guide from this RedirectScheme | Traefik | v2.2
My ingress controller configuration is bellow. The middleware is the same middlewares/redirectschema guide.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-service-ingress
annotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/router.tls: "true"
traefik.ingress.kubernetes.io/router.middlewares: default-redirect@kubernetescrd
spec:
rules:
- host: my-serivce.myapp.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: my-service
port:
number: 80
tls:
- secretName: whildcard.myapp.com
But traefik return 404 for every port and HTTP, HTTPS both,
I removed the middleware configuration from ingress config, Then treafik can route only https to my service . I found this guide When a TLS section is specified, it instructs Traefik that the current router is dedicated to HTTPS requests only (and that the router should ignore HTTP (non TLS) requests).
.
If then, How can I configure HTTP to https redirect from ingress configuration?
Traefik guide document is hard to apply k8s. Because there is no description for combining existing features.