Err_too_many_redirects

Team,

I’m going through practice lab and followed all the instructions provided in the questionnaire to achieve the end result but I’m getting too many redirects error when hit the url.
Lab: SERVICES & NETWORKING, INGRESS NETWORKING – 2 - Question - 9

URL:
_https://30080-port-e6e4042d9b974482.labs.kodekloud.com/watch
_https://30080-port-e6e4042d9b974482.labs.kodekloud.com/wear

Ingress object output:
root@controlplane:~# kubectl -n app-space describe ingress ingress-wear-watch
Name: ingress-wear-watch
Namespace: app-space
Address:
Default backend: default-http-backend:80 (<error: endpoints “default-http-backend” not found>)
Rules:
Host Path Backends


  •       /wear    wear-service:8080 (10.244.0.4:8080)
          /watch   video-service:8080 (10.244.0.5:8080)
    

Annotations: . //Tried with rewrite annotation too but failing
Events:

I’m getting the expected response when I hit the url with Cluster IP or Backend IPs which was part of ingress output.

Here is the ingress file which was used to create an ingress object.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-wear-watch
namespace: app-space
spec:
rules:

  • http:
    paths:
    • path: /wear
      pathType: Prefix
      backend:
      service:
      name: wear-service
      port:
      number: 8080
    • path: /watch
      pathType: Prefix
      backend:
      service:
      name: video-service
      port:
      number: 8080

Services output:
root@controlplane:~# kubectl get svc -n app-space
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default-http-backend ClusterIP 10.110.57.38 80/TCP 45m
video-service ClusterIP 10.96.199.184 8080/TCP 45m
wear-service ClusterIP 10.104.105.103 8080/TCP 45m

Could you please help me if there is an issue with the setup or version which was used in the lab environment?

Regards,
Krishna.

Hello @krishna748,
Try this

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-wear-watch
  namespace: app-space
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - http:
      paths:
      - path: /wear
        pathType: Prefix
        backend:
          service:
           name: wear-service
           port: 
            number: 8080
      - path: /watch
        pathType: Prefix
        backend:
          service:
           name: video-service
           port:
            number: 8080

Note: By default the controller redirects (301) to HTTPS if TLS is enabled for that Ingress. If you want to disable that behavior, you can use the nginx.ingress.kubernetes.io/ssl-redirect: "false" annotation.

And in the lab, we manage the HTTPS from our side, not from the ingress. So, you should add annotation nginx.ingress.kubernetes.io/ssl-redirect: "false"

for more info check this Annotations - Ingress-Nginx Controller

Thanks,
KodeKloud Support