Ingress Controller Ignores Namespace for the ingress

I’ve currently deployed the all-in-one postgres setup. I am basically trying to use a single kong ingress controller with 2 different environments dev/stage in their own namespaces.


apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: dashboard
namespace: demo
spec:
template:
metadata:
labels:
name: dashboard
app: dashboard
spec:
containers:
- name: dashboard
image: dc-dashboard:latest
ports:
- name: web
containerPort: 8080
protocol: TCP

apiVersion: v1
kind: Service
metadata:
name: dashboard-service
namespace: demo
spec:
selector:
app: dashboard
ports:
- name: dashboard-web
port: 80
targetPort: 8080
protocol: TCP

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: dashboard-ingress
namespace:demo
annotations:
kubernetes.io/ingress.class: “kong”
spec:
rules:
- host: k8.domain.cloud
http:
paths:
- path: /dashboard
backend:
serviceName: dashboard-service
servicePort: 80

The following setup works if i deploy everything under the default namespace, however, if it’s deployed in the demo namespace then the kong ingress controller the following errors

W0501 19:23:30.587411       6 queue.go:113] requeuing kong/kong-proxy, err error building kong state: building upstreams and targets: error getting endpoints for 'default/dashboard-service' service: error getting service 'default/dashboard-service' from the cache: service default/dashboard-service was not found
W0501 19:23:33.920767       6 queue.go:113] requeuing default/nginx, err error building kong state: building upstreams and targets: error getting endpoints for 'default/dashboard-service' service: error getting service 'default/dashboard-service' from the cache: service default/dashboard-service was not found

Have you ensured that the service actually exists in the demo namespace?

Also, it might happen that you create the Ingress resource first and the Ingress Controller complains about it and once your service is actually created, it won’t complain anymore.

Hope that helps!