Summary
In the new version of the ingress add-on, based on trafik instead of ingress-nginx, there is a IngressClass 'nginx',
which should works as ingress-nginx compatible provider
(reference: https://doc.traefik.io/traefik/reference/install-configuration/providers/kubernetes/kubernetes-ingress-nginx/).
However the IngressClass 'nginx' created buy the add-on use the traefik.io/ingress-controller provider, instead of the traefik providers.kubernetesIngressNginx.controllerClass which is k8s.io/ingress-nginx.
Nginx IngressClass defined in the add-on:
|
# IngressClass 'nginx' - for users with existing nginx ingress resources |
|
- apiVersion: networking.k8s.io/v1 |
|
kind: IngressClass |
|
metadata: |
|
name: nginx |
|
spec: |
|
controller: traefik.io/ingress-controller |
Traefik's ingress-nginx compatible provider defined in traefik helm chart:
https://github.com/traefik/traefik-helm-chart/blob/20a237feeeb5b541dae0b99bcdea8b94fae210a1/traefik/values.yaml#L368-L374
kubernetesIngressNginx:
# -- Enable Kubernetes Ingress NGINX provider (experimental)
enabled: false
# -- Ingress Class Controller value this controller satisfies
controllerClass: "k8s.io/ingress-nginx"
# -- Name of the ingress class this controller satisfies
ingressClass: "nginx"
So currently, the IngressClass 'nginx' is managed by the standard traefik provider instead of the ingress-nginx compatible one.
What Should Happen Instead?
The IngressClass 'nginx' should use the ingress-nginx compatible provider.
Reproduction Steps
- Install a recent version of the ingress addon:
microk8s enable ingress -V 39.0.0
- Install a app using an ingress with
spec.ingressClassName: nginx and using Traefik supported NGINX annotations, for example nginx.ingress.kubernetes.io/use-regex.
See an example bellow.
- Try to access the app using the ingress (
curl http://whoami.localhost/foo/bar for the provided example). The answer is not the one expected.
Non working example using the nginx IngressClass:
apiVersion: v1
kind: Service
metadata:
name: whoami
spec:
ports:
- port: 80
selector:
app: whoami
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: whoami
spec:
replicas: 2
selector:
matchLabels:
app: whoami
template:
metadata:
labels:
app: whoami
spec:
containers:
- name: whoami
image: traefik/whoami
ports:
- containerPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: whoami-nginx
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
spec:
ingressClassName: nginx
rules:
- host: whoami.localhost
http:
paths:
- path: /foo/.*
pathType: ImplementationSpecific
backend:
service:
name: whoami
port:
number: 80
Can you suggest a fix?
Change the IngressClass 'nginx' spec.controller to "k8s.io/ingress-nginx".
Are you interested in contributing with a fix?
Yes
Summary
In the new version of the ingress add-on, based on trafik instead of ingress-nginx, there is a
IngressClass'nginx',which should works as ingress-nginx compatible provider
(reference: https://doc.traefik.io/traefik/reference/install-configuration/providers/kubernetes/kubernetes-ingress-nginx/).
However the
IngressClass'nginx' created buy the add-on use thetraefik.io/ingress-controllerprovider, instead of the traefikproviders.kubernetesIngressNginx.controllerClasswhich isk8s.io/ingress-nginx.Nginx
IngressClassdefined in the add-on:microk8s-core-addons/addons/ingress/values.yaml
Lines 72 to 78 in ce8e8d1
Traefik's ingress-nginx compatible provider defined in traefik helm chart:
https://github.com/traefik/traefik-helm-chart/blob/20a237feeeb5b541dae0b99bcdea8b94fae210a1/traefik/values.yaml#L368-L374
So currently, the
IngressClass'nginx' is managed by the standard traefik provider instead of the ingress-nginx compatible one.What Should Happen Instead?
The
IngressClass'nginx' should use the ingress-nginx compatible provider.Reproduction Steps
microk8s enable ingress -V 39.0.0spec.ingressClassName: nginxand using Traefik supported NGINX annotations, for examplenginx.ingress.kubernetes.io/use-regex.See an example bellow.
curl http://whoami.localhost/foo/barfor the provided example). The answer is not the one expected.Non working example using the nginx IngressClass:
Can you suggest a fix?
Change the
IngressClass'nginx'spec.controllerto"k8s.io/ingress-nginx".Are you interested in contributing with a fix?
Yes