Is possible to configure ingress via PORT base routing?

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?

Not directly. The ingress API only has support for path based routing. Several ingress controllers have been extended to support port based routing through additional configuration via configmaps or annotations.

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: /
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:
{“apiVersion”:“v1”,“data”:{“9000”:“ingress-nginx/tomcat:8080”},“kind”:“ConfigMap”,“metadata”:{“annotations”:{},“name”:“tcp-services”,"name…

Data

9000:

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

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

Yes, it can’t do port based routing otherwise. If you look at the nginx example they add the additional ports to the ingress service.

Oki let me try

@mrbobbytables @experts

i have followed the 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

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.

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.

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

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 :grimacing: