Traefik 1.7 Kubernetes ingress http-redirect problem

Hi,
I use Traefik 1.7 in a Oracle K8s cluster. For this test I used an internal loadbalancer.
When I use only http Traefik works fine. I can access my service. The problem is when I try to use https an http-redirect.
For my test I generated self signed certificates.

My ingress looks like:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kubia-ingress
  labels:
    app: kubia
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  defaultBackend:
    service:
      name: kubia
      port:
        number: 80
  rules:
    - host: xxx.yyy.org
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: kubia
                port:
                  number: 80

I can access my k8s service without traefik.
But when I call it via curl and traefik-controller I see the following in the log:

  1. For "curl http://xxx.yyy.org"
    -->
    10.244.0.0 - - [22/Mar/2021:08:28:54 +0000] "GET / HTTP/1.1" 302 5 "-" "curl/7.61.1" 7 "entrypoint redirect for http" "/" 0ms

And the answer is "Found":

  1. When I call with https: "curl --insecure https://xxx.yyy.org/"
    I see in the traefik-logs
    10.244.0.0 - - [22/Mar/2021:08:31:14 +0000] "GET / HTTP/2.0" 404 19 "-" "curl/7.61.1" 10 "backend not found" "/" 0ms

However the service is existing and I can call it successful from with K8s.

$:~/traefik_certs$ k describe ingress kubia-ingress
Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
Name:             kubia-ingress
Namespace:        default
Address:          
Default backend:  kubia:80 (10.244.0.133:8080,10.244.0.7:8080,10.244.1.6:8080)
Rules:
  Host                          Path  Backends
  ----                          ----  --------
  xxx.yyy.org  
                                /   kubia:80 (10.244.0.133:8080,10.244.0.7:8080,10.244.1.6:8080)
Annotations:                    kubernetes.io/ingress.class: traefik
Events:                         <none>

What is wrong? Any hint? I would really like to solve this http-redirect-problem.

Thomas

Okay, the problem with the "https"-access is solved. I missed an entrypoint
I changed:

defaultEntryPoints = ["http"]

to

defaultEntryPoints = ["http","https"]

and now https-access works. But I still have no working redirect.

When I do a curl-call with https I see in the logs:
10.244.0.128 - - [22/Mar/2021:14:57:01 +0000] "GET / HTTP/2.0" 200 23 "-" "curl/7.61.1" 6 "xxx.yyy.org/" "http://10.244.0.7:8080" 4ms

When I call pure http with curl I see:

10.244.0.128 - - [22/Mar/2021:14:56:55 +0000] "GET / HTTP/1.1" 302 5 "-" "curl/7.61.1" 5 "entrypoint redirect for http" "/" 0ms

Hi @pirat8,

From what I understood you are going to create a redirection from HTTP to HTTPS, because it is not so clear for me. If so, you need to have two routers created, the first for HTTP and the second for HTTPS.
On the HTTP router, you are assigning the middleware with the appropriate configuration.

Here is the example that redirects from HTTP to HTTPS with 301 HTTP code.

I hope that helps. Let us know :slight_smile: ,