Kubernetes Ingress: Required value: pathType must be specified

1 min read | by Jordi Prats

While upgrading Ingress objects to networking.k8s.io/v1 you'll find out, among other changes that now the pathType is a required option:

spec.rules[0].http.paths[0].pathType: Required value: pathType must be specified, spec.rules[0].http.paths[1].pathType: Required value: pathType must be specified

We have tree options for selecting the pathType:

  • ImplementationSpecific: Matching will be handled by the IngressClass. Depending on the implementations can treat this in a different way

  • Exact: Matches the URL path exactly with case sensitivity.

  • Prefix: Matches based on a URL path prefix split by / (most common) It is also case sensitive on a path element by element basis.

An example of a Ingress object using pathType would be:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: demo
spec:
  rules:
    - host: "backend.pet2cattle.com"
      http:
        paths:
          - path: /*
            pathType: Prefix
            backend:
              service:
                name: ssl-redirect
                port:
                  name: use-annotation

          - path: /*
            pathType: Prefix
            backend:
              service:
                name: admin-pet2cattle
                port:
                  name: http

Posted on 20/04/2021

Categories