2

I need to map over a pure static IP with a specific port, it has no hostname attached to. The static IP is exactly the same as what a domain points to, but I need only the IP. The Entrypoint is on a specific port - actually port 9735.

I have this working but I am unsure if I am doing it correct. For testing purposes I added a simple whoami website on there.

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: whoami

spec:
  entryPoints:
    - lnd1
  routes:
    - match: Path(`/`)
      kind: Rule
      services:
        - name: whoami
          port: 80

So if I go to my browser and add

http://88.x.x.x:9735

Then it works. if I put

http://88.x.x.x:9735/somepath

It does not. Is it possible to use a wildcard with

    - match: Path(`/`)

Or maybe this is completely the wrong direction. Although it does work, maybe its not the right approach..

All I need to do is capture all traffic on a specific port (not 80 or 443) and forward it to a service.

I know the entrypoints are setup correctly as they are working, for reference, I am using this

ports:
  lnd1:
    port: 9735
    expose: true
    exposedPort: 9735
    # The port protocol (TCP/UDP)
    protocol: TCP

My doubt is weather I should be using a Match (can you exclude it :-) ? ) - and what kind of match I should be using.

Any ideas

Thanks in advance

chresse
  • 5,486
  • 3
  • 30
  • 47
Ian Gregson
  • 199
  • 2
  • 8

1 Answers1

0

In traefik docs I have found that beside the Path() rule, there is also PathPrefix() which is most probably what you want to use.

Here is what the docs says:

Path Vs PathPrefix

Use Path if your service listens on the exact path only. For instance, Path: /products would match /products but not /products/shoes.

Use a Prefix matcher if your service listens on a particular base path but also serves requests on sub-paths. For instance, PathPrefix: /products would match /products but also /products/shoes and /products/shirts. Since the path is forwarded as-is, your service is expected to listen on /products.

So your ingress route would look like following:

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: whoami
spec:
  entryPoints:
    - lnd1
  routes:
    - match: PathPrefix(`/`)    # <-------------
      kind: Rule
      services:
        - name: whoami
          port: 80
Matt
  • 7,419
  • 1
  • 11
  • 22