CodexBloom - Programming Q&A Platform

Kubernetes Ingress Not Routing to Services in Different Namespaces on v1.24

👀 Views: 26 💬 Answers: 1 📅 Created: 2025-06-17
kubernetes ingress networking yaml

I'm reviewing some code and Does anyone know how to I'm upgrading from an older version and This might be a silly question, but I'm working with an scenario with Kubernetes Ingress where it seems to unexpected result in routing requests to services that are located in different namespaces..... I have an Ingress resource set up in the `frontend` namespace, and it is supposed to forward traffic to a service in the `backend` namespace. However, when I try to access the endpoint, I receive a 404 behavior. My Ingress resource looks like this: ```yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: frontend-ingress namespace: frontend spec: rules: - host: myapp.example.com http: paths: - path: /api pathType: Prefix backend: service: name: backend-service port: number: 80 ``` The `backend-service` is defined in the `backend` namespace as follows: ```yaml apiVersion: v1 kind: Service metadata: name: backend-service namespace: backend spec: ports: - port: 80 targetPort: 8080 selector: app: backend-app ``` I’ve confirmed that the service is up and running in the `backend` namespace and that the pods are healthy. I've also tried changing the path in the Ingress rule to `/` to see if that made a difference, but the 404 continues. I’ve checked the Ingress controller logs and found entries like: ``` 2023/10/10 12:30:00 [behavior] 123#123: *4567 no resolver defined to resolve myapp.example.com, client: 192.168.1.1, server: myapp.example.com, request: "GET /api HTTP/1.1" 404 0 "-" "curl/7.68.0" ``` This indicates that the Ingress controller is having trouble resolving the hostname. I’ve also ensured that the Ingress controller is deployed correctly and has the necessary RBAC permissions for cross-namespace access. Can anyone guide to understand how to properly configure my Ingress to route to a service in a different namespace? Is there a specific annotation or configuration that I might be missing? I'm working on a application that needs to handle this. My team is using Yaml for this application. What's the correct way to implement this? This issue appeared after updating to Yaml latest. Has anyone dealt with something similar? I'm coming from a different tech stack and learning Yaml. Am I missing something obvious?