Welcome to the Linux Foundation Forum!

Lab 11.2 Why Ingress rule is not working?

Hi!

I'm stuck at step 10 from Lab 11.2.

I've used ingress.yaml config from labs solutions folder:

  1. apiVersion: networking.k8s.io/v1
  2. kind: Ingress
  3. metadata:
  4. name: ingress-test
  5. namespace: default
  6. spec:
  7. rules:
  8. - host: www.external.com
  9. http:
  10. paths:
  11. - backend:
  12. service:
  13. name: web-one
  14. port:
  15. number: 80
  16. path: /
  17. pathType: ImplementationSpecific
  18. status:
  19. loadBalancer: {}

Applied it successfully:

  1. [14:02]user@ubuntu-vbox-k8s-master[ingress-nginx]$ kubectl get ingress
  2. NAME CLASS HOSTS ADDRESS PORTS AGE
  3. ingress-test <none> www.external.com 80 11m

And got working web-one service and other:

  1. [14:02]user@ubuntu-vbox-k8s-master[ingress-nginx]$ kubectl get svc
  2. NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
  3. kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 30d
  4. myingress-ingress-nginx-controller LoadBalancer 10.100.135.99 <pending> 80:31209/TCP,443:31337/TCP 13m
  5. myingress-ingress-nginx-controller-admission ClusterIP 10.105.23.218 <none> 443/TCP 13m
  6. web-one ClusterIP 10.103.23.224 <none> 80/TCP 7h26m
  7. web-two ClusterIP 10.108.186.93 <none> 80/TCP

Then I tried Curl:

  1. [14:03]user@ubuntu-vbox-k8s-master[ingress-nginx]$ curl 10.100.135.99
  2. <html>
  3. <head><title>404 Not Found</title></head>
  4. <body>
  5. <center><h1>404 Not Found</h1></center>
  6. <hr><center>nginx</center>
  7. </body>
  8. </html>

It was expected, but I've got same for request with header:

  1. [14:04]user@ubuntu-vbox-k8s-master[ingress-nginx]$ curl -H "Host: www.external.com" http://10.100.135.99
  2. <html>
  3. <head><title>404 Not Found</title></head>
  4. <body>
  5. <center><h1>404 Not Found</h1></center>
  6. <hr><center>nginx</center>
  7. </body>
  8. </html>

Could anybody help?
Thanks in advance,

Best Answer

  • Posts: 2,451
    edited October 2021 Answer ✓

    Hi @Gim6626,

    As mentioned in an earlier solution, due to recent changes in the Ingress and Controller relationship, an annotation is required on the Ingress resource:

    1. ...
    2. metadata:
    3. annotations:
    4. kubernetes.io/ingress.class: nginx
    5. name: ingress-test
    6. ...

    Regards,
    -Chris

Answers

  • Posts: 27
    edited October 2021

    Step 15 does not work too, but in other way - it just shows fixed nginx page does not matter what header is passed

  • Posts: 27

    Thank you, it works!

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training