kubernetes-ingress
kubernetes-ingress copied to clipboard
Routing to ExternalName services doesn't work for ones created on the command line.
Describe the bug Looks like I may have hit bug or doing something wrong. I am trying setup routing to an ExternalName service that I have created using the CLI and getting the following error: W0610 18:52:33.302089 1 controller.go:2133] Error retrieving endpoints for the service test-nginx: No port {0 80 } in service test-nginx
There is no port definition required for externalname services. Even the example show in the repo : https://github.com/nginxinc/kubernetes-ingress/tree/master/examples/externalname-services
To Reproduce Steps to reproduce the behavior:
- Deploy the complete example from the examples folder
- Create an externalname service via the cli in the same namespace as the ingress definition example: `kubectl -n default create service externalname foo --external-name=foo.example.com
- Add a route to the ingress to the externalname
- Try to go to the route and you will get a 503 error.
Expected behavior The route should work the same as if I had used a manifest to create the externalname service
Your environment AKS in Azure
- Version of the Ingress Controller - release version or a specific commit main branch from repo
- Version of Kubernetes Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.1", GitCommit:"5e58841cce77d4bc13713ad2b91fa0d961e69192", GitTreeState:"clean", BuildDate:"2021-05-12T14:18:45Z", GoVersion:"go1.16.4", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.11", GitCommit:"c6a2f08fc4378c5381dd948d9ad9d1080e3e6b33", GitTreeState:"clean", BuildDate:"2021-05-13T17:14:18Z", GoVersion:"go1.15.12", Compiler:"gc", Platform:"linux/amd64"}
- Kubernetes platform (e.g. Mini-kube or GCP) AKS
- Using NGINX or NGINX Plus NGINX Plus
Additional context I have also submitted a F5 ticket as well.
https://my.f5.com/manage/s/case/5001T00001V0papQAB/routing-to-externalname-services-doesnt-work-for-ones-created-on-the-command-line
Aha! Link: https://nginx.aha.io/features/IC-236
Hi @outcast thanks for reporting!
Be sure to check out the docs while you wait for a human to take a look at this :slightly_smiling_face:
Cheers!
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.
bump
@outcast When using our externalName with NGINX Ingress Controller, NGINX Ingress controller requires that external name services do not have any selectors requires.
For example:
kind: Service
apiVersion: v1
metadata:
name: my-service
spec:
type: ExternalName
externalName: my.service.example.com
When you create your externalName service using the imperative method like you did, it will automatically add selectors to the config, which will not work with our Ingress controller:
For example, externalname created imperatively:
kubectl create service externalname ext-test --external-name nginx.org -n nginx-ingress --dry-run=client -oyaml
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app: ext-test
name: ext-test
namespace: nginx-ingress
spec:
externalName: nginx.org
selector:
app: ext-test
type: ExternalName
status:
loadBalancer: {}
Let us know if you have any questions.
Wouldn't this still be considered a bug since it breaks Kubernetes norms and should be accounted for in code?
@outcast I would not classify this a bug. I would say it would be a feature request to have our externalName support selectors.
or ignore them? :P
IMHO - the outlier here is how command-line created objects behave. The assumptions that are made for you when you define objects using the command line. That said. There is an opportunity. However, the use of a selector does complicate the API interaction as it becomes a query instead of a direct path so that might complicate things.