Reputation: 871
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)
Upvotes: 6
Views: 34314
Reputation: 1960
For those installing the helm chart from Kubernetes, here is the key config while installing:
--set controller.ingressClassResource.default=true
This differs from the one (controller.ingressClass.setAsDefaultIngress
) found in NGINX docs.
Full command:
helm upgrade --install ingress-nginx ingress-nginx \
--repo https://kubernetes.github.io/ingress-nginx \
--set controller.ingressClassResource.default=true \
--namespace ingress-nginx --create-namespace
Upvotes: 0
Reputation: 1
"IngressClass with name nginx has an invalid Spec.Controller k8s.io/ingress-nginx"
Getting the above error even after following this link- https://github.com/nginxinc/kubernetes-ingress/blob/master/deployments/common/ingress-class.yaml
Upvotes: -3
Reputation: 871
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.
Upvotes: 9
Reputation: 31
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.
Upvotes: 3