Configure Projects with Global Network in OpenShift

We will have requirements, where customer need to configure multiple projects but they want pods inside those projects to communicate each other. Since each projects will have its own netnamespace, communication will not happen between them by default. We can easily achieve this cross-communication as below.

Check current netnamespace of the projects. You can see different ID’s as below.

# oc get netnamespace | grep myapp
myapp-test                750807
myapp-test-db             5402669
myapp-test-data           6503429

Let’s join the projects with join-projects option.

# oadm pod-network join-projects --to=myapp-test-db myapp-test myapp-test-data 

Verify the ID’s again; you can see all got the same netnamespace ID as

# oc get netnamespace | grep myapp
myapp-test                5402669
myapp-test-db             5402669
myapp-test-data           5402669

That’s all.

You can use isolate-projects option as below, to isolate project network.

# oc adm pod-network isolate-projects <project1> <project2>

Aneesh Mohan

System Engineer

You may also like...

Leave a Reply

Notify of
%d bloggers like this: