0
votes

I created the following ingressClass while my ingress-nginx controller was already running:

apiVersion: networking.k8s.io/v1beta1
kind: IngressClass
metadata:
  name: nginx
  annotations:
    ingressclass.kubernetes.io/is-default-class: "true"
spec:
  controller: example.com/ingress-nginx-controller

And all works well, newly created ingresses get assigned the "nginx" ingress class automatically and my ingress nginx controller handles them as expected.

However, upon restarting the ingress-nginx-controller pod, I receive the following error in its logs & it keeps:

I1206 05:23:22.968400       8 main.go:115] "Enabling new Ingress features available since Kubernetes v1.18"
E1206 05:23:22.971801       8 main.go:134] Invalid IngressClass (Spec.Controller) value "quivr.be/ingress-nginx-controller". Should be "k8s.io/ingress-nginx"
F1206 05:23:22.971832       8 main.go:135] IngressClass with name nginx is not valid for ingress-nginx (invalid Spec.Controller)
2

2 Answers

2
votes

This error occurs because the spec.controller field of the IngressClass resource cannot contain just any domain name. The domain name & controller name is specific to the ingress controller you deploy.

For the ingress-nginx controller this needs to be k8s.io/ingress-nginx as directed in the error logs.

For other controllers like nginx ingress (not the same as ingress-nginx) this should be nginx.org/ingress-controller as directed here: https://github.com/nginxinc/kubernetes-ingress/blob/master/deployments/common/ingress-class.yaml

p.s. I know this seems really obvious in hindsight because the solution is literally in the error logs, but being able to google this error would have saved very tired me some time.

0
votes

first of all, there are two different nginx ingress controllers. one is developed by google/kubernetes maintainers is called ingress-nginx. another one is provided by Nginx team and named nginx-ingress. these controllers are completely different and separate. The one you are talking about seems to be google's one https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal

I tried to follow the same document to install it on bare-metal, but got exactly the same error by default. looks like the manifest deploy.yaml is outdated OR incompatible with the latest kubernetes v1.20.2 (?)

then I tried the one provided by Nginx team https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests/ and successfully deployed it without any issues on the latest kubernetes. the instruction is detailed enough. it also supports ingress for custom tcp/udp ports AFAIK, there are two ways to define custom TCP/UDP ports, I used this way: https://docs.nginx.com/nginx-ingress-controller/configuration/transportserver-resource/ now I've got mysql exposed to home local net.