What is the difference between Ingress and IngressRoute

I currently have the following to do http...

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ha-ingress
  annotations:
    kubernetes.io/ingress.class: "traefik"
spec:
  rules:
    - http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: ha-service
                port:
                  number: 80

This has been working great but now I want to upgrade to HTTPS. I see the documentation for Traefik says to use an IngressRoute. Is that just a drop in replacement for the annotated Ingress?

Hello @jrgleason,

Ingress objects are kubernetes native objects, and their contents are defined by the kubernetes project.

IngressRoutes are custom resources that are defined by the Traefik team, and expose more complex functionality that Traefik can provide.

If you are happy with your ingress objects, you can continue to use them, and use annotations and secrets to manage the certificates: (Kubernetes Ingress - Traefik). Many third party projects only work with ingress objects, so this may be your best option.

If you are looking to perform more complex routing, or to take advantage of more features, then you will need to use the IngressRoute objects.

1 Like

For now I just want to forward everything to https and setup TLS. Right now I am stuck using http till I figure it out. So no real complexity rt now.

I will check out the link TY

Would an IngressRoute be able to replace an ingress?

Hello @jrgleason,

Yes, IngressRoutes would replace your ingresses. You can also use a combination of both if you require.

Also I am trying this...

---
apiVersion: v1
kind: Secret
metadata:
  name: supersecret

data:
  tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0=
  tls.key: LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCi0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0=
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ha-ingress
  annotations:
    kubernetes.io/ingress.class: "traefik"
    traefik.ingress.kubernetes.io/router.entrypoints: "websecure"
    traefik.ingress.kubernetes.io/router.tls: "true"
spec:
  rules:
    - http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: ha-service
                port:
                  number: 80
  tls:
    - secretName: supersecret

Per those docs but I am not sure how to edit the endpoint and it doesn't seem to help it still goes to http.

NM Https is working but http is also working I need to forward 80 to 443 any idea about that step?

Hello @jrgleason

If you would like to only redirect HTTPS on one ingress, you should create a redirection middleware (RedirectScheme - Traefik) and then apply it to the ingress via annotations (Kubernetes Ingress - Traefik)

If you want to just blindly forward all http requests to https, then you may want to use entrypoint redirection instead: (EntryPoints - Traefik)

Please note that entrypoint redirection is all-or-nothing, you cannot selectively choose what gets redirected.

I tried to add...

apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: test-redirectscheme
spec:
  redirectScheme:
    scheme: https
    permanent: true

and I got

error: unable to recognize "home-assistant/hass.yml": no matches for kind "Middleware" in version "traefik.containo.us/v1alpha1"

Also where would I add endpoints to? I still don't understand that part. It will be blind forwarding.