My Kubernetes ingress has the following:
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: alb
...
...
# -- Defines which ingress controller will implement the resource
ingressClassName: ""
I'm a bit confused about the difference between "kubernetes.io/ingress.class" and "ingressClassName.".
I believe "kubernetes.io/ingress.class" needs to match the ingressClass as defined in the AWS ALB Ingress Controller.
However, then I'm confused about the role of "ingressClassName"? As that seems to be the same thing.
Any clarity would be appreciated.
CodePudding user response:
Actually, both refer to the same thing, but kubernetes.io/ingress.class
is deprecated from Kubernetes v1.22 . and ingressClassName
is introduced in 1.18
, so if you are using higher version you can ingressClassName
Before the
IngressClass
resource andingressClassName
field were added in Kubernetes 1.18, Ingress classes were specified with akubernetes.io/ingress.class
annotation on the Ingress. This annotation was never formally defined, but was widely supported by Ingress controllers.
The newer
ingressClassName
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 IngressClass resource that contains additional Ingress configuration,
Your example is
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: alb
its equivalent value is className: "nginx"
ingress:
enabled: true
className: "alb" -> ingressClassName
if you check the ingress
template, it will be like this
ingressClassName: {{ .Values.ingress.className }}