Knative routing of cluster local host names does not match k8s dns behavior
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 1.2k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 2
Description
## In what area(s)?
/area API
/area networking
## What version of Knative?
> 1.6 with Istio
## Expected Behavior
Assume that the foobar service is deployed to the baz namespace, and we are trying to call foobar from another pod in the baz namespace. Calls of the form `curl foobar` should work with knative, the same as with a normal k8s Service, which will automatically route to `foobar.baz`.
## Actual Behavior
A 404 error is returned, as the service cannot be routed. Calls with the namespace included like `curl foobar.baz` will work as expected. This appears to be due to the way the Istio Gateway, VirtualService, or KIngresses are configured.
This should at least be documented since it breaks the notion of Knative hiding Kubernetes abstraction details. It's not clear to me if this is easy to fix, since the gateway would have to know or discover the namespace of the client. The workaround is to change all clients to use the hostname with a namespace.
For users that are migrating existing K8S services to Knative, this can be a surprise since foobar.baz and foobar.baz.svc.cluster.local work normally.
## Steps to Reproduce the Problem
* Deploy an image using a K8s Deployment and Service. Shell into the Pod and curl the service without the namespace. It should succeed.
* Delete the K8s Deployment and Service, and re-deploy the image as a Knative service, using the same name. Curl it without the namespace, and it should return 404.
Contributor guide
Research direction
Reproduce the behavior with a Kubernetes Service and then a Knative Service, comparing requests to the short hostname and the namespace-qualified hostname. Start by examining the Istio Gateway, VirtualService, and KIngress configuration involved in routing. Done means either the short hostname routes like Kubernetes DNS or the limitation and workaround are documented clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kubernetes
- Domain
- api, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100