nginx-ingress not forwarding to dashboard
It seems to me that you've used wrong location path /dashboard
within yours origin Ingress
configuration, even more the relevant K8s dashboard UI endpoint is exposed on 443
port by default across the corresponded K8s Service resource, whenever you've not customized this setting.
ports:- port: 443 protocol: TCP targetPort: 8443
In order to get a proper path based routing, override existing parameters with the following arguments:
paths:- path: / backend: serviceName: kubernetes-dashboard servicePort: 443
Once you've decided accessing K8s dashboard UI through indirect path holder URL (https://abc.def.com/dashboard), you can manage applying Rewrite rules in order to transparently change a part of the authentic URL and transmit requests to the faithful target path. Actually, Nginx Ingress controller adds this functionality via specific nginx.ingress.kubernetes.io/rewrite-target
annotation:
apiVersion: extensions/v1beta1kind: Ingressmetadata: name: dashboard annotations: nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" nginx.ingress.kubernetes.io/force-ssl-redirect: "false" nginx.ingress.kubernetes.io/rewrite-target: /$2 namespace: kube-systemspec:# tls:# - hosts:# - abc.def.com rules: - host: abc.def.com http: paths: - path: /dashboard(/|$)(.*) backend: serviceName: kubernetes-dashboard servicePort: 443
This can happen if your cluster doesn't have nginx
as the default ingress class, and your ingress manifest doesn't specify one.
You can try one of the following:- Upgrade your NGINX-ingress installation with controller.ingressClass
set to nginx
(with this, all ingresses created will use NGINX-ingress by default)- Add the kubernetes.io/ingress.class: nginx
annotation to your ingress yaml to specify that you want NGINX-ingress to handle it.