# Is possible to configure ingress via PORT base routing?

**URL:** https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167
**Category:** General Discussions
**Tags:** development
**Created:** [July 16, 2019, 9:26am UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167 "2019-07-16T09:26:12Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![vikas4cloud](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vikas4cloud](https://discuss.kubernetes.io/u/vikas4cloud)
#### Post date: [July 16, 2019, 9:26am UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167/1 "2019-07-16T09:26:12Z")

</div>

Hello I am new to GKE in Kubernetes:)  
i would like to use ingress controller for my project  
here we are using haproxy ingress controller and able to use ingress via PATH base but we want to use PORT base routing.  
is this possible to configure ingress via PORT base routing?

---

<div class="post-metadata">

### Author: ![mrbobbytables](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/mrbobbytables/32/7_2.png) [@mrbobbytables](https://discuss.kubernetes.io/u/mrbobbytables)
#### Post date: [July 16, 2019, 11:39am UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167/2 "2019-07-16T11:39:53Z")

</div>

Not directly. The ingress API only has support for path based routing. [Several ingress controllers](https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/exposing-tcp-udp-services.md) have been extended to support port based routing through additional configuration via configmaps or annotations.

---

<div class="post-metadata">

### Author: ![vikas4cloud](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vikas4cloud](https://discuss.kubernetes.io/u/vikas4cloud)
#### Post date: [July 19, 2019, 9:13am UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167/3 "2019-07-19T09:13:43Z")

</div>

Thanks @mrbobbytables rbobbytables i have exposed tcp-udp-services… but not worked for PORT base routing

here is my details

ingress.yaml

apiVersion: extensions/v1beta1  
kind: Ingress  
metadata:  
name: example-ingress  
annotations:  
[nginx.ingress.kubernetes.io/rewrite-target:](http://nginx.ingress.kubernetes.io/rewrite-target:) /  
spec:  
rules:

- http:  
paths:  
- path: /tomcat  
backend:  
serviceName: tomcat  
servicePort: 8080  
- path: /httpd  
backend:  
serviceName: httpd  
servicePort: 80

kubectl describe configmap tcp-services  
Name: tcp-services  
Namespace: ingress-nginx  
Labels:   
Annotations: [kubectl.kubernetes.io/last-applied-configuration:](http://kubectl.kubernetes.io/last-applied-configuration:)  
{“apiVersion”:“v1”,“data”:{“9000”:“ingress-nginx/tomcat:8080”},“kind”:“ConfigMap”,“metadata”:{“annotations”:{},“name”:“tcp-services”,"name…

# Data

9000:

---

<div class="post-metadata">

### Author: ![mrbobbytables](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/mrbobbytables/32/7_2.png) [@mrbobbytables](https://discuss.kubernetes.io/u/mrbobbytables)
#### Post date: [July 19, 2019, 11:51am UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167/4 "2019-07-19T11:51:37Z")

</div>

Did you open up the additional ports for the ingress service itself?

---

<div class="post-metadata">

### Author: ![vikas4cloud](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vikas4cloud](https://discuss.kubernetes.io/u/vikas4cloud)
#### Post date: [July 19, 2019, 12:40pm UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167/5 "2019-07-19T12:40:12Z")

</div>

No not opened any port is that required

I am new to this can you please elaborate more on this as my path base routing is working

---

<div class="post-metadata">

### Author: ![mrbobbytables](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/mrbobbytables/32/7_2.png) [@mrbobbytables](https://discuss.kubernetes.io/u/mrbobbytables)
#### Post date: [July 19, 2019, 12:42pm UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167/6 "2019-07-19T12:42:54Z")

</div>

Yes, it can’t do port based routing otherwise. If you look at the [nginx example](https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/exposing-tcp-udp-services.md) they add the additional ports to the ingress service.

---

<div class="post-metadata">

### Author: ![vikas4cloud](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vikas4cloud](https://discuss.kubernetes.io/u/vikas4cloud)
#### Post date: [July 19, 2019, 12:47pm UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167/7 "2019-07-19T12:47:48Z")

</div>

Oki let me try

---

<div class="post-metadata">

### Author: ![vikas4cloud](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vikas4cloud](https://discuss.kubernetes.io/u/vikas4cloud)
#### Post date: [July 22, 2019, 11:09am UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167/8 "2019-07-22T11:09:02Z")

</div>

@mrbobbytables @experts

i have followed the [https://kubernetes.github.io/ingress-nginx/deploy/](https://kubernetes.github.io/ingress-nginx/deploy/) this documentation Using Helm for created the ingress controller as well as i want to expose the external IP via LoadBalancer and path base routing is working.

as this is loadbalancer configuration how can i open the port for service

can you please help me out to achieve PORT base routing

---

<div class="post-metadata">

### Author: ![mrbobbytables](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/mrbobbytables/32/7_2.png) [@mrbobbytables](https://discuss.kubernetes.io/u/mrbobbytables)
#### Post date: [July 22, 2019, 11:35am UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167/9 "2019-07-22T11:35:00Z")

</div>

> [@vikas4cloud](#):
>
> i have followed the [Installation Guide - Ingress-Nginx Controller](https://kubernetes.github.io/ingress-nginx/deploy/) this documentation Using Helm for created the ingress controller as well as i want to expose the external IP via LoadBalancer and path base routing is working.

The `LoadBalancer` service needs to have the additional ports you want forwarded added to it. An example is included at the [Nginx Ingress - Exposing TCP and UDP Services Documentation](https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/).

---

<div class="post-metadata">

### Author: ![ashwini](https://avatars.discourse-cdn.com/v4/letter/a/b5ac83/32.png) [@ashwini](https://discuss.kubernetes.io/u/ashwini)
#### Post date: [August 6, 2019, 5:09am UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167/10 "2019-08-06T05:09:39Z")

</div>

Vikas, it’s already been explained well. If you still want some fix, inbox me. We may connect locally over phone or email if you want.

---

<div class="post-metadata">

### Author: ![vikas4cloud](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@vikas4cloud](https://discuss.kubernetes.io/u/vikas4cloud)
#### Post date: [August 6, 2019, 7:25am UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167/11 "2019-08-06T07:25:11Z")

</div>

Hi @ashwini Please share your email ID or send a test mail to [Vikas4cloud@gmail.com](mailto:Vikas4cloud@gmail.com) i will be very happy to connect to you

---

<div class="post-metadata">

### Author: ![mrbobbytables](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/mrbobbytables/32/7_2.png) [@mrbobbytables](https://discuss.kubernetes.io/u/mrbobbytables)
#### Post date: [August 6, 2019, 11:35am UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167/12 "2019-08-06T11:35:39Z")

</div>

You can actually use discuss to message privately. You may want to do that and edit your post so that your email isn’t spidered and indexed 😬

---

<div class="post-metadata">

### Author: ![Bernhard\_Fuchs](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/bernhard_fuchs/32/6702_2.png) [@Bernhard\_Fuchs](https://discuss.kubernetes.io/u/Bernhard_Fuchs)
#### Post date: [January 13, 2021, 3:44pm UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167/13 "2021-01-13T15:44:54Z")

</div>

Is this also possible with ALB ingress from AWS?  
Tried to tweak the example but no luck so far.

---

<div class="post-metadata">

### Author: ![harpreetV](https://avatars.discourse-cdn.com/v4/letter/h/87869e/32.png) [@harpreetV](https://discuss.kubernetes.io/u/harpreetV)
#### Post date: [June 14, 2021, 10:52am UTC](https://discuss.kubernetes.io/t/is-possible-to-configure-ingress-via-port-base-routing/7167/14 "2021-06-14T10:52:43Z")

</div>

Hi @vikas4cloud. I have similar requirement. Have you found the solution for the PORT based routing?
