I have 3 services in my ingress, the first 2 use default
namespace. The third service is prometheus-server service which has namespace ingress-nginx
. Now, I want to map my prometheus DNS to the service, but getting error because ingress can't find the prometheus service in default
namespace.
How to deal with non-default namespace in ingress definition?
You will need to refer to your service in the other namespace with its full path, that is prometheus-server.ingress-nginx.svc.cluster.local
.
You shouldn’t need a second Ingress to do this.
You would want to create a new Ingress
in namespace ingress-nginx
that would route your DNS to that service. For example:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: example
namespace: ingress-nginx
spec:
rules:
- host: your.domain.com
http:
paths:
- path: /
backend:
serviceName: prometheus-server
servicePort: 80