Objective: all the traffic should happen on https (443) only. Any http calls should be redirected to https
Given:
-
k3s with trafik as the Ingress. this is the default and no changes are made to the traefik or k3s specifically for ingress routing.
-
the current routing is using http and is working fine. I want to move to https.
-
all the examples on internet use let's encrypt which uses cert-manager and a complex configuration. Some have even recommended to remove default traefik and install a newer version). I do not have much knowledge about traefik.
-
my certificate consists of two files. domain.com.cert and domain.com.key
-
I have already loaded the certificate in the k3s in k8s secret. the secret name is tls-security. the two keys are tls.crt and tls.key
-
I need to use the certificate and also want to redirect the traffic, if it comes on http (80) should be redirected to https (443)
here is my current file:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: scm-ingress
namespace: scm
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
spec:
tls:
- hosts:
- domain.com
secretName: tls-secret
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: gateway
port:
number: 80
I'm getting 404 when I access using https://domain.com/myEP.
If I change that to http://domain.com/myEP then everything works as before.
- How do I redirect to https from http and
- why I get 404 when https is used