<p>Given this yaml:</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress-2
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: test.com
    http:
      paths:
      - backend:
          serviceName: admin
          servicePort: 8080
        path: /admin/*
        pathType: ImplementationSpecific
      - backend:
          serviceName: keycloak
          servicePort: 8080
        path: /auth/*
        pathType: ImplementationSpecific
</code></pre>
<p>I would like the <code>rewrite-target</code> to only apply to the service <code>admin</code>. Requests to <code>keycloak</code> should not be affected. How can I achieve that?</p>

Alloys
<p>You can separate out ingress file or config, just make sure you keep the different name</p>
<p>So you can you create <strong>TWO</strong> ingress</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress-1
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: test.com
    http:
      paths:
      - backend:
          serviceName: admin
          servicePort: 8080
        path: /admin/*
        pathType: ImplementationSpecific
</code></pre>
<p><strong>Ingress</strong>: <strong>2</strong> with different config, you can edit anything as per need now remove annotation.</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress-2
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - host: test.com
    http:
      paths:
      - backend:
          serviceName: keycloak
          servicePort: 8080
        path: /auth/*
        pathType: ImplementationSpecific
</code></pre>
<p>If you want to store everything in a single YAML file you can also do it by merging them with <code>---</code>.</p>
