Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

kubectl apply ingress: Unknown field error

I have ingress as:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: mongoexpress-ingress
spec:
  rules:
  - host: mylocalmongoexpress.com
    http:
      paths:
      - backend:
          serviceName: mongoexpress-service
          servicePort: 8081

When I run ‘kubectl apply -f mongoexpress-ingress.yaml’, I get error:

error: error validating "mongoexpress-ingress.yaml": error validating
data: [ValidationError(Ingress.spec.rules[0].http.paths[0].backend):
unknown field "serviceName" in
io.k8s.api.networking.v1.IngressBackend,
ValidationError(Ingress.spec.rules[0].http.paths[0].backend): unknown
field "servicePort" in io.k8s.api.networking.v1.IngressBackend,
ValidationError(Ingress.spec.rules[0].http.paths[0]): missing required
field "pathType" in io.k8s.api.networking.v1.HTTPIngressPath]; if you
choose to ignore these errors, turn validation off with
–validate=false

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Going through online resources, I couldn’t find issue in yaml file.

So what am I missing here?

>Solution :

Ingress specification has changed from v1beta1 to v1. Try:

...
spec:
  rules:
  - host: mylocalmongoexpress.com
     http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: mongoexpress-service
            port:
              number: 8081
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading