How to use the TLS certificate/ https in k3s for traefik

Objective: all the traffic should happen on https (443) only. Any http calls should be redirected to https


  1. k3s with trafik as the Ingress. this is the default and no changes are made to the traefik or k3s specifically for ingress routing.

  2. the current routing is using http and is working fine. I want to move to https.

  3. 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.

  4. my certificate consists of two files. and

  5. 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

  6. 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:

kind: Ingress
  name: scm-ingress
  namespace: scm
  annotations: web
  - hosts:
    secretName: tls-secret  
    - http:
        - path: /
          pathType: Prefix
              name: gateway
                number: 80

I'm getting 404 when I access using
If I change that to then everything works as before.

  • How do I redirect to https from http and
  • why I get 404 when https is used