<p>I have ingress as:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: mongoexpress-ingress
spec:
  rules:
  - host: mylocalmongoexpress.com
    http:
      paths:
      - backend:
          serviceName: mongoexpress-service
          servicePort: 8081
</code></pre>
<p>When I run 'kubectl apply -f mongoexpress-ingress.yaml', I get error:</p>
<blockquote>
<p>error: error validating &quot;mongoexpress-ingress.yaml&quot;: error validating
data: [ValidationError(Ingress.spec.rules[0].http.paths[0].backend):
unknown field &quot;serviceName&quot; in
io.k8s.api.networking.v1.IngressBackend,
ValidationError(Ingress.spec.rules[0].http.paths[0].backend): unknown
field &quot;servicePort&quot; in io.k8s.api.networking.v1.IngressBackend,
ValidationError(Ingress.spec.rules[0].http.paths[0]): missing required
field &quot;pathType&quot; in io.k8s.api.networking.v1.HTTPIngressPath]; if you
choose to ignore these errors, turn validation off with
--validate=false</p>
</blockquote>
<p>Going through online resources, I couldn't find issue in yaml file.</p>
<p>So what am I missing here?</p>

Mandroid
<p>Ingress specification <a href="https://kubernetes.io/docs/reference/using-api/deprecation-guide/#ingress-v122" rel="nofollow noreferrer">has changed</a> from v1beta1 to v1. Try:</p>
<pre><code>...
spec:
  rules:
  - host: mylocalmongoexpress.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: mongoexpress-service
            port:
              number: 8081
</code></pre>
