makozaki
makozaki

Reputation: 4366

PCF - exposing routes of each application instance

I have a manifest.yml as follows

applications:
  - MY-APP
  instances:3
  ...

PCF starts application correctly with 3 instances which are hidden after one static route my-app.<pcfhost>.com. Is there a way to expose routes of each application instance with manifest.yml properties? e.g. my-app-1.<pcfhost>.com, my-app-2.<pcfhost>.com, my-app-3.<pcfhost>.com

Upvotes: 0

Views: 1139

Answers (1)

arjain13
arjain13

Reputation: 606

If you deploy your app to Cloud Foundry and scale it to three instances, a component called Route-Emitter that watches the Diego runtime service would discover there are three instances of an application, the IP and ports for these instances, and the route for this app (e.g. myapp.cf.com). Route-Emitter sends a registration message to NATS, and Gorouter receives the registration message (it is subscribed to NATS). Requests for myapp.cf.com will now be load balanced across the three instances of your application. Router uses a basic round-robin approach to load balancing between application instances, and this algorithm can not be directly modified.

If you are using Cloud Foundry, this is all taken care of for you automatically. Thus you cannot assign the routes to each instance.

You can reach individual instances of an application using the X-Cf-App-Instance header: https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains.html#surgical-routing

Upvotes: 2

Related Questions