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
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