Connect pod to legacy external application

Hi,

We are trying to find the best way to connect a pod within our cluster to an external legacy app.
In the past, there were two such apps talking to each other; we will replace one of them.
The connection requirements are very strict:

  • each app knows and checks the IP and port of the remote partner
  • the communication is based on UDP
  • based on some configuration flag value, either us or the external legacy app will initiate communication

For the moment we do the following:

  • assign the expected IPs to the node we are deploying our app on
  • the hostNetwork is set to true for the microservice involved in the communication (in the spec part of the template inside the deployment)
  • we have a CLusterIP service and an ingress to help route the traffic to/from out app

Is there any better way to do this, without tieing the respective app to the node network?
Like maybe a ClusterIP with and endpoint pair tosolve trafic from our app to the legacy one?
How should we set up such a pair?
But how should we handle the other direction?

Thank you,
Alin