Hi all, i am a little bit confused in terms of what structure format to follow o . . .

Peter Lee:
Hi all, i am a little bit confused in terms of what structure format to follow on writing yaml file. for example, this is question #9 under practice test - CKA Ingress Networking part 2:
Create the ingress resource to make the applications available at /wear and /watch on the Ingress service. Create the ingress in the app-space

— my attempt answer was (wrong answer):
apiVersion: http://networking.k8s.io/v1|networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-wear-watch
namespace: ingress-space
spec:
rules:

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

but the answer was this:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-wear-watch
namespace: app-space
annotations:
http://nginx.ingress.kubernetes.io/rewrite-target|nginx.ingress.kubernetes.io/rewrite-target: /
http://nginx.ingress.kubernetes.io/ssl-redirect|nginx.ingress.kubernetes.io/ssl-redirect: “false”
spec:
rules:

  • http:
    paths:
    • path: /wear
      backend:
      serviceName: wear-service
      servicePort: 8080
    • path: /watch
      backend:
      serviceName: video-service
      servicePort: 8080

is there reference or any tip what format to follow? thanks in advance

Hinodeya learn:
I’think you’re talking about syntax not format arround the yaml just follow the awesome lesson https://kodekloud.com/p/json-path-quiz

Mohamed Ayman:
You can use the k8s documentation for ingress

https://kubernetes.io/docs/concepts/services-networking/ingress/|https://kubernetes.io/docs/concepts/services-networking/ingress/