问题
I use Pivotal Cloud Foundry. I have numerous apps (microservices) running in the same space. I want all the apps in this space to be able to connect to each other.
It means every time I deploy a new app (microservice) I have to setup container-to-container (c2c) policies between the new app and the new apps (cf add-network-policy
). This is very tedious and provides absolutely no value. Is there a way to set up a "default space policy", so that all the apps deployed in the same space will have c2c connectivity between each other?
回答1:
It's currently (as of me writing this post) not possible with the cf cli & add-network-policy. Only the lowest level primitive is supported, app to app.
Your best bet for an immediate solution would be to script it. Pull a list of all the apps in your target space, enumerate them and add a policy for each app, or something along those lines. You just need to run that any time the app list changes.
I'm not affiliated with the project, but looking at the backlog, it looks like there are improvements coming to this area. I see things like being able to use an IP range as a destination. You can could also provide some feedback through the Github project, if you feel strongly about your use case.
Hope that helps!
回答2:
Container-to-Container networking is possible in PCF-V2.
https://docs.pivotal.io/pivotalcf/2-0/devguide/deploy-apps/cf-networking.html
来源:https://stackoverflow.com/questions/51290854/enable-container-to-container-networking-between-all-the-apps-in-the-space