Reputation: 143
I am trying to set up an Ingress resource in the default namespace that routes traffic to:
default
namespace)kubernetes-dashboard
namespace)However, my Ingress is failing to find the kubernetes-dashboard
service.
default
namespace)apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: main-ingress
namespace: default
spec:
ingressClassName: nginx
rules:
- host: apps.k8s
http:
paths:
- path: /mongo-admin
pathType: Prefix
backend:
service:
name: mongo-express-service
port:
number: 80
- path: /dashboard
pathType: Prefix
backend:
service:
name: kubernetes-dashboard
port:
number: 80
kubectl describe ingress main-ingress
)Rules:
Host Path Backends
---- ---- --------
apps.k8s
/mongo-admin mongo-express-service:80 (working)
/dashboard kubernetes-dashboard:80 (<error: services "kubernetes-dashboard" not found>)
Checked if kubernetes-dashboard
service exists
kubectl get svc -n kubernetes-dashboard
The service is running:
NAME TYPE CLUSTER-IP PORT(S) AGE
kubernetes-dashboard ClusterIP 10.96.234.56 443/TCP 30m
Verified that Ingress is running
kubectl get pods -n ingress-nginx
Attempted to directly access the dashboard service using port-forwarding
kubectl port-forward svc/kubernetes-dashboard -n kubernetes-dashboard 8443:443
This works, but I want to use Ingress instead.
Since Ingress only works with services in the same namespace, how can I configure Ingress in the default
namespace while routing to the kubernetes-dashboard
service in kubernetes-dashboard
namespace?
Is there a proper way to do this without moving the Ingress to kubernetes-dashboard
?
Upvotes: 0
Views: 26