启用空间中所有应用程序之间的容器到容器联网 [英] Enable container-to-container networking between all the apps in the space

查看:72
本文介绍了启用空间中所有应用程序之间的容器到容器联网的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Pivotal Cloud Foundry。我在同一个空间中运行着许多应用程序(微服务)。我希望该空间中的所有应用程序都能相互连接。

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.

这意味着每次我部署新应用程序(微服务)时,我都必须在新应用程序和新应用程序之间设置容器到容器(c2c)策略( cf add-network-policy )。这非常繁琐,绝对没有任何价值。有没有一种方法可以设置默认空间策略,以便部署在同一空间中的所有应用程序之间都可以实现c2c连接?

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?

推荐答案

使用cf cli&添加网络策略。每个应用程序仅支持最低级别的原语。

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.

我与该项目无关,但请查看积压,看来该领域已有改进。我看到诸如能够将IP范围用作目标之类的东西。您还可以通过 Github提供一些反馈项目,如果您对用例有强烈的兴趣。

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.

希望有帮助!

这篇关于启用空间中所有应用程序之间的容器到容器联网的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆