<p>I am setting up an ingress service following some k8s documentation, but I am not able to understand the following annotations:</p>
<p><code>kubernetes.ip/ingress.class:</code></p>
<p><code>nginx.ingress.kubernetes.io/rewrite-target:</code></p>
<p>Do you know what these annotations do?</p>
<p>Thanks in advance.</p>

<ol>
<li><code>kubernetes.io/ingress.class</code> annotation is officially <a href="https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#deprecating-the-ingress-class-annotation" rel="nofollow noreferrer">deprecated</a>:</li>
</ol>
<blockquote>
<p>Before the <code>IngressClass</code> resource was added in Kubernetes 1.18, a
similar concept of Ingress class was often specified with a
<code>kubernetes.io/ingress.class</code> annotation on the Ingress. Although this
annotation was never formally defined, it was widely supported by
Ingress controllers, and should now be considered formally deprecated.</p>
</blockquote>
<p>Instead you should use the <code>ingressClassName</code>:</p>
<blockquote>
<p>The newer <code>ingressClassName</code> field on Ingresses is a replacement for
that annotation, but is not a direct equivalent. While the annotation
was generally used to reference the name of the Ingress controller
that should implement the Ingress, the field is a reference to an
<code>IngressClass</code> resource that contains additional Ingress
configuration, including the name of the Ingress controller.</p>
</blockquote>
<ol start="2">
<li>The <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#rewrite" rel="nofollow noreferrer">rewrite annotation</a> does as follows:</li>
</ol>
<blockquote>
<p>In some scenarios the exposed URL in the backend service differs from
the specified path in the Ingress rule. Without a rewrite any request
will return 404. Set the annotation
<code>nginx.ingress.kubernetes.io/rewrite-target</code> to the path expected by
the service.</p>
<p>If the Application Root is exposed in a different path and needs to be
redirected, set the annotation <code>nginx.ingress.kubernetes.io/app-root</code>
to redirect requests for <code>/</code>.</p>
</blockquote>
<p>For a more detailed example I strongly suggest you can check out this <a href="https://kubernetes.github.io/ingress-nginx/examples/rewrite/" rel="nofollow noreferrer">source</a>. It shows exactly how rewriting works.</p>
