Welcome to the Linux Foundation Forum!

Exercise 10.1: Advanced Service Exposure - error in the code

I am using kubernetes v1.20.

I noticed that in point 8 (creating ingress yaml) the structure of the rule yaml looks like that:
http:
paths:
- backend:
serviceName: secondapp
servicePort: 80
path: /

After starting ingress. In point 15 there is the task to edit the rules.
It looks like kubernetes reformatted the configuration (code from pdf is not working)

spec:
rules:
- host: www.example.com
http:
paths:
- backend:
service:
name: secondapp
port:
number: 80
path: /
pathType: ImplementationSpecific
- host: thirdpage.org
http:
paths:
- backend:
service:
name: thirdpage
port:
number: 80
path: /
pathType: ImplementationSpecific

Comments

  • chrispokornichrispokorni Posts: 993

    Hi @shinhf,

    As Kubernetes matures, minor changes in the API are expected, especially when a resource advances from beta to stable level of support. Comparing lab exercises with the documentation is recommended to catch such minor changes in the API resource definitions, commands, arguments, flags, and options.

    Regards,
    -Chris

  • guillermottiguillermotti Posts: 3
    edited March 24

    Yep, this ingress.rule.yaml worked for me:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
    name: ingress-test
    annotations:
    kubernetes.io/ingress.class: traefik
    spec:
    rules:
    - host: www.example.com
    http:
    paths:
    - backend:
    service:
    name: secondapp
    port:
    number: 80
    path: /
    pathType: ImplementationSpecific

  • chrispokornichrispokorni Posts: 993

    Hi @guillermotti,

    The Code markups from the Format menu help to preserve the YAML indentation.

    Regards,
    -Chris

  • guillermottiguillermotti Posts: 3
    edited March 25

    Sorry for that, this is the preserved YAML:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: ingress-test
      annotations:
        kubernetes.io/ingress.class: traefik
    spec:
      rules:
      - host: www.example.com
        http:
          paths:
          - backend:
              service:
                name: secondapp
                port: 
                  number: 80
            path: /
            pathType: ImplementationSpecific
    
Sign In or Register to comment.