<p>I can not understand how to achieve such a result as in nginx configuration:</p>
<pre><code>location /api/ {
  proxy_pass http://xyz:9000/api_server/;
}
</code></pre>
<p>but with ingress. If I understand correctly <a href="https://kubernetes.github.io/ingress-nginx/examples/rewrite/#app-root" rel="nofollow noreferrer">nginx.ingress.kubernetes.io/app-root</a> is a redirection, but not proxying</p>

andrey.ladniy
<p>Each ingress rule works already as a <code>proxy_pass</code> directive. So you can use the <code>nginx.ingress.kubernetes.io/rewrite-target</code> annotation in your case:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /api_server/$2
spec:
  rules:
  - http:
      paths:
      - path: /api(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: my-service-xyz
            port:
              number: 9000
</code></pre>
