Enabling Database Connectivity
The integration flow needs access to the database, but it isn’t reachable yet. Let’s find out why, and enable the connection.
| This exercise uses a single cluster to keep things focused, but Service Interconnect is designed for far more than a network policy can handle — multi-site meshes spanning clusters, regions, and cloud providers. A brief real-world example at the end shows it in that broader context. |
Why can’t you reach the database?
The backend database is hosted in an isolated namespace (shared-database) with strict network policies — no direct access is allowed from other namespaces.
flowchart LR
subgraph yoursLabel ["username-devspaces"]
subgraph yours [" "]
Client[DB Client]
end
end
Client -.-x|"❌ unreachable"| SVC
subgraph sharedLabel [shared-database]
subgraph shared [" "]
SVC((svc))
SVC --- DB[(PostgreSQL)]
end
end
style yoursLabel fill:none,stroke:none
style sharedLabel fill:none,stroke:none
style DB fill:#336,color:#fff
Try it yourself — run a simple query against the database (from your terminal in Dev Spaces):
What does this command do?
|
The connection will time out — the database is not directly accessible from your namespace:
Connecting to postgres.shared-database.svc:5432 (timeout: 5s)... ERROR: Cannot connect to postgres.shared-database.svc:5432
Bridging namespaces with Service Interconnect
Red Hat Service Interconnect (built from the open-source project Skupper.io) solves this by creating encrypted application-level connections between namespaces — without requiring VPNs, firewall rules, or exposing services to the public network.
Once configured, a local service is created in your namespace that transparently forwards traffic to the remote database:
flowchart LR
subgraph yoursLabel ["username-devspaces"]
subgraph yours [" "]
Client[DB Client]
SI1{{"Service\nInterconnect"}}
end
end
Client --> SI1
SI1 -.-|"🔒 secure link"| SI2
subgraph sharedLabel [shared-database]
subgraph shared [" "]
SI2{{"Service\nInterconnect"}}
SVC((svc))
SVC --- DB[(PostgreSQL)]
end
end
SI2 --> SVC
style yoursLabel fill:none,stroke:none
style sharedLabel fill:none,stroke:none
style DB fill:#336,color:#fff
From your application’s perspective, the database will appear as a local service — no special configuration needed.
Under the hood
Service Interconnect uses a set of resources to establish and manage the connection. Here’s how the previous diagram breaks down:
flowchart LR
subgraph yoursLabel ["username-devspaces"]
subgraph yours [" "]
Client[DB Client]
SVC2((svc))
subgraph S2 ["Site (App)"]
Listener((Listener))
Grant["🪪 AccessGrant"]
end
end
end
Client --> SVC2 --> Listener
S2 ~~~ S1
S2 -.-|"🔒 secure link"| S1
subgraph sharedLabel [shared-database]
subgraph shared [" "]
subgraph S1 ["Site (DB)"]
Connector((Connector))
Token["🔑 AccessToken"]
end
SVC((svc))
SVC --- DB[(PostgreSQL)]
end
end
Connector --> SVC
Grant ~~~ Token
style yoursLabel fill:none,stroke:none
style sharedLabel fill:none,stroke:none
style S2 fill:#e8eaf6,stroke:#7986cb
style S1 fill:#e8eaf6,stroke:#7986cb
style Grant fill:#fff,stroke:#7986cb
style Listener fill:#fff,stroke:#7986cb
style Token fill:#fff,stroke:#7986cb
style Connector fill:#fff,stroke:#7986cb
style DB fill:#336,color:#fff
| Hover over each component in the diagram to learn what it does. |
The database lives in a secure, air-tight environment — no inbound ports are exposed. To keep it that way, the link is initiated from the database side outward to your site. This is why you create an AccessGrant on your side: it gives the database site permission to connect to you and establish a bidirectional communication link. Its environment never opens an entrypoint that could be exploited.
What you will do
Every Service Interconnect setup follows two stages: first you establish the network — the secure mesh that connects your environments — then you expose services through it. Once the network is in place, adding a new service is just a matter of pairing a Listener with a Connector — no network changes needed.
flowchart LR
subgraph netLabel ["① Establish the network"]
subgraph net [" "]
direction LR
S1@{ shape: processes, label: "Sites" } -.-|"🔒 secure links"| S2@{ shape: processes, label: "Sites" }
end
end
subgraph svcLabel ["② Expose services"]
subgraph svc [" "]
direction LR
LA@{ shape: processes, label: "Listeners" } --- CA@{ shape: processes, label: "Connectors" }
end
end
netLabel ~~~ svcLabel
style netLabel fill:none,stroke:none
style svcLabel fill:none,stroke:none
style net fill:#e8eaf6,stroke:#7986cb
style svc fill:#e8f5e9,stroke:#66bb6a
style S1 fill:#fff,stroke:#7986cb
style S2 fill:#fff,stroke:#7986cb
style LA fill:#fff,stroke:#66bb6a
style CA fill:#fff,stroke:#66bb6a
In this exercise, that translates to:
Establish the network — create the secure link between namespaces:
-
A Site already exists in the
shared-databasenamespace (pre-configured) -
Create a Site in your namespace with
linkAccessenabled -
Generate an AccessGrant so the database namespace can connect to you
-
Create an AccessToken in the database namespace to establish the link
Expose the database service — make the remote database accessible locally (in username-devspaces):
-
A Connector already bridges the Skupper network to PostgreSQL on port
5432(pre-configured) -
Create a Listener to expose the remote database as a local service
flowchart LR
subgraph yoursLabel2 ["username-devspaces"]
subgraph yours2 [" "]
Client[DB Client]
SVC2((svc))
subgraph S2 ["✏️ Site (App)"]
Listener(("✏️ Listener"))
Grant["✏️ AccessGrant"]
end
end
end
Client --> SVC2 --> Listener
S2 ~~~ S1
S2 -.-|"🔒 secure link"| S1
subgraph sharedLabel2 [shared-database]
subgraph shared2 [" "]
subgraph S1 ["✅ Site (DB)"]
Connector(("✅ Connector"))
Token["✏️ AccessToken"]
end
SVC((svc))
SVC --- DB[(PostgreSQL)]
end
end
Connector --> SVC
Grant ~~~ Token
style yoursLabel2 fill:none,stroke:none
style sharedLabel2 fill:none,stroke:none
style S2 fill:#ffe0b2,stroke:#fb8c00
style S1 fill:#c8e6c9,stroke:#66bb6a
style Listener fill:#fff3e0,stroke:#fb8c00
style Grant fill:#fff3e0,stroke:#fb8c00
style Token fill:#fff3e0,stroke:#fb8c00
style Connector fill:#e8f5e9,stroke:#66bb6a
style DB fill:#336,color:#fff
✅ Already configured by the platform team
✏️ Your tasks
Step 0: Explore the Server Side (Optional)
You have read-only access to the shared-database namespace. Take a moment to inspect what the platform team has set up.
View the Skupper resources:
You should see output similar to:
NAME STATUS SITES IN NETWORK MESSAGE site.skupper.io/database-site Ready 1 OK NAME ROUTING KEY PORT HOST SELECTOR STATUS HAS MATCHING LISTENER MESSAGE connector.skupper.io/postgres postgres 5432 app=postgres Pending No matching listeners
Notice the Connector status is Pending with No matching listeners — that’s expected. You will create the matching Listener later in this exercise.
These are the two pre-configured resources from the diagram. Here’s what you need to complete:
flowchart LR
Left["<div style='text-align:left'><b>✅ Configured</b><br/>• Site (DB)<br/>• Connector</div>"]
Progress["33% (pre-configured)<br/>████████░░░░░░░░░░░░░░░░░░"]
Right["<div style='text-align:left'><b>✏️ Remaining</b><br/>• Site (App)<br/>• AccessGrant<br/>• AccessToken<br/>• Listener</div>"]
Left --- Progress --- Right
style Left fill:#e8f5e9,stroke:#66bb6a,stroke-width:3px,color:#1b5e20,rx:10,ry:10
style Progress fill:#f1f8e9,stroke:#66bb6a,stroke-width:10px,color:#2e7d32,font-size:17px,rx:10,ry:10
style Right fill:#fff3e0,stroke:#fb8c00,stroke-width:3px,color:#e65100,rx:10,ry:10
Establish the network
The first step is to set up the secure network between your namespace and the database namespace. This involves creating a Site, an AccessGrant, and an AccessToken — together, these establish an encrypted link between the two environments.
Step 1: Create a Site in Your Namespace
Create a Site with linkAccess enabled. This makes your namespace a listening site that can accept incoming connections from the database.
Verify the Site is ready:
Wait until the STATUS column shows Ready:
NAME STATUS SITES IN NETWORK MESSAGE
username-site Ready 1 OK
Your Site is ready. Here’s your progress:
flowchart LR
Left["<div style='text-align:left'><b>✅ Completed</b><br/>• Site (DB)<br/>• Connector<br/>• Site (App)</div>"]
Progress["50% Complete<br/>█████████████░░░░░░░░░░░░░"]
Right["<div style='text-align:left'><b>✏️ Remaining</b><br/>• AccessGrant<br/>• AccessToken<br/>• Listener</div>"]
Left --- Progress --- Right
style Left fill:#e8f5e9,stroke:#66bb6a,stroke-width:3px,color:#1b5e20,rx:10,ry:10
style Progress fill:#f1f8e9,stroke:#66bb6a,stroke-width:10px,color:#2e7d32,font-size:17px,rx:10,ry:10
style Right fill:#fff3e0,stroke:#fb8c00,stroke-width:3px,color:#e65100,rx:10,ry:10
Step 2: Create an AccessGrant
Before jumping in, remember that the link is initiated from Site (DB) (database) to Site (App) (yours). Here’s how the grant and token work together to make that happen:
sequenceDiagram
actor A as Admin<br/>(You)
participant S2 as Site (App)
participant S1 as Site (DB)
A-->>S2: Create AccessGrant
Note over S2: AccessGrant
A-->>S1: Create AccessToken
Note over S1: AccessToken
S1-->>S2: Redeem token
S2-->>S1: Transfer link details
S1->>S2: Create link
Note over S2,S1: 🔒 secure link established
You create an AccessGrant on your Site (App) and an AccessToken on Site (DB). The database site then redeems the token to establish a secure link back to you.
Now, create the AccessGrant:
Wait for the AccessGrant to be ready and retrieve its details:
Wait until the STATUS column shows Ready:
NAME REDEMPTIONS ALLOWED REDEMPTIONS MADE EXPIRATION STATUS MESSAGE
grant-username 1 2026-03-27T11:29:08Z Ready OK
Your AccessGrant is ready. Here’s your progress:
flowchart LR
Left["<div style='text-align:left'><b>✅ Completed</b><br/>• Site (DB)<br/>• Connector<br/>• Site (App)<br/>• AccessGrant</div>"]
Progress["67% Complete<br/>████████████████░░░░░░░░░░"]
Right["<div style='text-align:left'><b>✏️ Remaining</b><br/>• AccessToken<br/>• Listener</div>"]
Left --- Progress --- Right
style Left fill:#e8f5e9,stroke:#66bb6a,stroke-width:3px,color:#1b5e20,rx:10,ry:10
style Progress fill:#f1f8e9,stroke:#66bb6a,stroke-width:10px,color:#2e7d32,font-size:17px,rx:10,ry:10
style Right fill:#fff3e0,stroke:#fb8c00,stroke-width:3px,color:#e65100,rx:10,ry:10
Step 3: Create an AccessToken in the Database Namespace
Now create an AccessToken in the shared-database namespace to establish the link from the database to your namespace. The token must be named token-username.
Extract the grant details and create the AccessToken:
After a few moments, a Link resource is automatically created in shared-database. Verify:
Wait until the link status shows Ready:
NAME STATUS REMOTE SITE MESSAGE token-username Ready username-site OK
Almost there — one more resource to go:
flowchart LR
Left["<div style='text-align:left'><b>✅ Completed</b><br/>• Site (DB)<br/>• Connector<br/>• Site (App)<br/>• AccessGrant<br/>• AccessToken</div>"]
Progress["83% Complete<br/>█████████████████████░░░░░"]
Right["<div style='text-align:left'><b>✏️ Remaining</b><br/>• Listener</div>"]
Left --- Progress --- Right
style Left fill:#e8f5e9,stroke:#66bb6a,stroke-width:3px,color:#1b5e20,rx:10,ry:10
style Progress fill:#f1f8e9,stroke:#66bb6a,stroke-width:10px,color:#2e7d32,font-size:17px,rx:10,ry:10
style Right fill:#fff3e0,stroke:#fb8c00,stroke-width:3px,color:#e65100,rx:10,ry:10
Expose the database service
The network is now in place — your namespace and the database namespace are connected through an encrypted link. But having a network alone doesn’t give you access to the database. You still need to tell Service Interconnect which service to expose into your namespace.
This is where Listeners and Connectors come in. The Connector on the database side is already configured (you saw it in Step 0). Now you need to create a matching Listener on your side.
Step 4: Create a Listener to Expose the Database Locally
The Listener creates a local service in your namespace that forwards traffic to the remote PostgreSQL database through the encrypted link.
The routingKey must match the one configured on the Connector in the shared-database namespace. The platform team set it to postgres.
|
Verify the Listener is ready:
You should see output similar to:
NAME ROUTING KEY PORT HOST STATUS HAS MATCHING CONNECTOR MESSAGE postgres-listener postgres 5432 postgres Ready true OK
When a Listener is created, Service Interconnect automatically exposes the backend service as a local service in your environment:
flowchart RL
subgraph S2 [" "]
Listener((Listener))
end
Listener -.->|creates| SVC2((svc))
style S2 fill:#c8e6c9,stroke:#66bb6a
style SVC2 fill:#e8f5e9,stroke:#66bb6a
style Listener fill:#e8f5e9,stroke:#66bb6a
Verify the postgres service is available:
You should see the service available locally:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE postgres ClusterIP 172.31.121.30 <none> 5432/TCP 21s
All resources are in place:
flowchart LR
Left["<div style='text-align:left'><b>✅ Completed</b><br/>• Site (DB)<br/>• Connector<br/>• Site (App)<br/>• AccessGrant<br/>• AccessToken<br/>• Listener</div>"]
Progress["100% Complete<br/>██████████████████████████"]
Left --- Progress
style Left fill:#e8f5e9,stroke:#66bb6a,stroke-width:3px,color:#1b5e20,rx:10,ry:10
style Progress fill:#e8f5e9,stroke:#66bb6a,stroke-width:10px,color:#2e7d32,font-size:17px,rx:10,ry:10
Step 5: Verify the connection
Now let’s verify the connection works. Run the same query as before, but this time targeting the local service — thanks to Service Interconnect, the database is now reachable from your namespace:
What does this command do?
|
You should see output similar to:
Connecting to postgres:5432 (timeout: 5s)... count ----- 1 (1 row(s))
The count is 1 because your lab environment comes with a sample entry already loaded in the database.
|
Summary
Here’s the full picture of what you’ve built:
flowchart LR
subgraph yoursLabel3 ["username-devspaces"]
subgraph yours3 [" "]
Client[DB Client]
SVC2((svc))
subgraph S2 ["✅ Site (App)"]
Listener((Listener))
Grant["🪪 AccessGrant"]
end
end
end
Client --> SVC2 --> Listener
S2 ~~~ S1
S2 -.-|"🔒 secure link"| S1
subgraph sharedLabel3 [shared-database]
subgraph shared3 [" "]
subgraph S1 ["✅ Site (DB)"]
Connector((Connector))
Token["🔑 AccessToken"]
end
SVC((svc))
SVC --- DB[(PostgreSQL)]
end
end
Connector --> SVC
Grant ~~~ Token
style yoursLabel3 fill:none,stroke:none
style sharedLabel3 fill:none,stroke:none
style S2 fill:#c8e6c9,stroke:#66bb6a
style S1 fill:#c8e6c9,stroke:#66bb6a
style Grant fill:#e8f5e9,stroke:#66bb6a
style Listener fill:#e8f5e9,stroke:#66bb6a
style SVC2 fill:#e8f5e9,stroke:#66bb6a
style Token fill:#e8f5e9,stroke:#66bb6a
style Connector fill:#e8f5e9,stroke:#66bb6a
style DB fill:#336,color:#fff
You have successfully:
-
Established the network — Created a Site and AccessGrant in your namespace, and an AccessToken in the database namespace to form an encrypted link.
-
Exposed the service — Created a Listener that makes the remote database accessible locally through the network.
-
Verified connectivity — Used a script to query the database through the encrypted link.
The database lives in a secure, air-tight environment — the connection was initiated from the database side to yours through an encrypted Skupper link. No network policy changes, no VPNs, no elevated permissions required.
The link you’ve established will stay active — you’ll need it in the next exercise to implement the full data flow: ingesting policy applications, storing them in the database, and rendering PDF policy documents.
Beyond this exercise: Service Interconnect at scale
In this lab you connected two namespaces on the same cluster — a simple setup to demonstrate the concepts. In the real world, Service Interconnect shines when connecting services across multiple clusters, regions, and cloud providers — all sharing the same secure mesh.
Consider a retail organization with stores across different regions, each running AI-powered services. Edge sites collect training data and run inference against locally deployed models. Redundant on-prem data centers handle the heavy lifting — training new AI/ML models and pushing updated versions back to the stores. Regional hubs aggregate traffic from nearby edges before forwarding it to the core.
flowchart LR
subgraph left [" "]
direction TB
subgraph E1L ["London"]
E1["AI data →\nAI model ←"]
end
subgraph E2L ["Berlin"]
E2["AI data →\nAI model ←"]
end
end
HL((Hub\nFrankfurt))
subgraph coreLabel [" "]
direction TB
subgraph DC1 ["Data Center 1"]
AI1(AI Model Training)
end
subgraph DC2 ["Data Center 2"]
AI2(AI Model Training)
end
end
HR((Hub\nSingapore))
subgraph right [" "]
direction TB
subgraph E3L ["Tokyo"]
E3["← AI data\n→ AI model"]
end
subgraph E4L ["Sydney"]
E4["← AI data\n→ AI model"]
end
end
E1 -.-|"🔒 N links"| HL
E2 -.-|"🔒 N links"| HL
HL -.-|"🔒 N links"| AI1
HL -.-|"🔒 N links"| AI2
AI1 -.-|"🔒 N links"| HR
AI2 -.-|"🔒 N links"| HR
HR -.-|"🔒 N links"| E3
HR -.-|"🔒 N links"| E4
style left fill:none,stroke:none
style right fill:none,stroke:none
style E1L fill:none,stroke:none
style E2L fill:none,stroke:none
style E3L fill:none,stroke:none
style E4L fill:none,stroke:none
style coreLabel fill:none,stroke:none
style DC1 fill:#e8eaf6,stroke:#7986cb
style DC2 fill:#e8eaf6,stroke:#7986cb
style AI1 fill:#fff,stroke:#7986cb
style AI2 fill:#fff,stroke:#7986cb
style HL fill:#e8eaf6,stroke:#7986cb
style HR fill:#e8eaf6,stroke:#7986cb
style E1 fill:#f5f5f5,stroke:#ccc
style E2 fill:#f5f5f5,stroke:#ccc
style E3 fill:#f5f5f5,stroke:#ccc
style E4 fill:#f5f5f5,stroke:#ccc
Each edge site pushes training data to the core and pulls updated models back. Multiple links between sites provide redundant routing — if one path fails, traffic flows through another. Hubs add a further layer of resilience: if the Frankfurt hub goes down, edges can reroute through Singapore. Redundant data centers ensure the AI pipeline stays available even during maintenance or outages.
The same two-stage pattern you just learned applies here: Sites and links form the network, while Listeners and Connectors expose the specific services at each end. The difference is scale — instead of two namespaces on one cluster, this spans multiple regions, hubs, and data centers. But the building blocks are identical.