DevOps in K8s — Ingress, Part Three

<p>IngressClass is a concept in K8s that was introduced in v1.18. It allows you to specify how Ingresses should be implemented within a cluster.</p> <p>Before IngressClass, the annotation system was used to configure the behavior of the Ingress controller, which sometimes led to confusion and misconfiguration. With IngressClass, these configurations can be standardized across all Ingresses.</p> <p>Let&rsquo;s say you&rsquo;re using the NGINX Ingress controller and you&rsquo;ve used an annotation like&nbsp;<code>nginx.ingress.kubernetes.io/rewrite-target</code>&nbsp;in your Ingress definitions to set the URL rewrite target.</p> <p>Now, you want to switch to another Ingress controller, for instance,&nbsp;<code>Traefik</code>. You will find that the same annotation doesn&rsquo;t work with&nbsp;<code>Traefik</code>, as it uses a different set of annotations. As a result, you&rsquo;d have to modify all the Ingress definitions where you used the&nbsp;<strong>NGINX-specific</strong>&nbsp;annotations to make them work with&nbsp;<code>Traefik</code>, which can be a time-consuming process.</p> <p>By using IngressClass, you can avoid the above problem. IngressClass allows you to define a template with all the configurations for a specific class of Ingresses. This improves standardization, helps with type safety, and declutters your Ingress definitions.</p> <p><a href="https://tonylixu.medium.com/devops-in-k8s-ingress-part-three-96ee26c4ccce">Click Here</a></p>