Home > other >  Ingress Resource file error AKS - spec.rules[0].http.paths[0].pathType: Required value: pathType mus
Ingress Resource file error AKS - spec.rules[0].http.paths[0].pathType: Required value: pathType mus

Time:05-18

I am following MS documentation to create ingress NGINX controller

https://docs.microsoft.com/en-us/learn/modules/aks-workshop/07-deploy-ingress

But below yaml file is giving me error : The Ingress "ratings-web-ingress" is invalid: spec.rules[0].http.paths[0].pathType: Required value: pathType must be specified

Command : kubectl apply --namespace ratingsapp -f ratings-web-ingress.yaml --validate=false

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ratings-web-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: frontend.20-83-140-186.nip.io # IMPORTANT: update <ingress ip> with the dashed public IP of your ingress, for example frontend.13-68-177-68.nip.io
    http:
      paths:
      - path: /
      pathType: Prefix
      backend:
      service:
      name: ratings-web
      port:
      number: 80

CodePudding user response:

I tried to reproduce creating ingress NGINX controller with the same code and got the same error:

image1

To resolve the error "spec.rules[0].http.paths[0].pathType: Required value: pathType must be specified" replace pathType: ImplementationSpecific after pathType like below:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ratings-web-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: frontend.10.0.0.1.nip.io # IMPORTANT: update <ingress ip> with the dashed public IP of your ingress, for example frontend.13-68-177-68.nip.io
    http:
      paths:
      - backend:
          service:
            name: ratings-web
            port:
              number: 80
        path: /
        pathType: ImplementationSpecific

After modifying the yaml file, I was able to create ingress successfully:

image2

For more in detail, please refer below link:

Lab10.1 - Error creating ingress rule: "pathType must be specified" — Linux Foundation Forums

  • Related