A transparent proxy is a type of server that can intercept network traffic to and from a service without changes to the client application code. In the case of Kong Mesh, it is used to capture traffic and redirect it to a data plane to apply policies.
Kong Mesh uses iptables and offers additional, experimental support for eBPF.
Here’s a high level visualization of how transparent proxying works:
sequenceDiagram
autonumber
participant Browser as client
(Mobile app)
participant Kernel as Kernel
participant ServiceMeshIn as kuma sidecar(15006)
participant Node as example.com:5000
(Front-end app)
participant ServiceMeshOut as kuma sidecar(15001)
Browser->>+Kernel: GET / HTTP1.1
Host: example.com:5000
rect rgb(233,233,233)
Note over Kernel,ServiceMeshOut: EXAMPLE.COM
Note over Node: (Optional)
Apply inbound policies
Note over ServiceMeshOut: (Optional)
Apply inbound policies
Kernel->>+ServiceMeshIn: Capture inbound TCP traffic
and redirect to the sidecar
(listener port 15006)
ServiceMeshIn->>+Node: Redirect to the
original destination
(example.com:5000)
Node->>+Kernel: Send the
front-end response
Kernel->>+ServiceMeshOut: Capture outbound TCP traffic
and Redirect to the sidecar
(listener port 15001)
end
ServiceMeshOut->>+Browser: Response to client
If you choose to not use transparent proxying, or if you’re running on a platform where transparent proxying isn’t available, there are some additional considerations:
- You need to specify the inbound and outbound ports that you want to capture traffic on.
-
.meshaddresses are unavailable. - You may need to update your application code to use the new capture ports.
- VirtualOutbound is unsupported.
Without manipulating iptables to redirect traffic, you will need to explicitly tell kuma-dp where to listen to capture it. This can require changes to your application code.
The example below specifies that kuma-dp will listen on the address 10.119.249.39:15000.
This in turn creates an Envoy listener for the port.
When consuming a service over this address, it will cause traffic to redirect to 127.0.0.1:5000 where our app is running:
type: Dataplane
mesh: default
name: demo-app
networking:
address: 10.119.249.39
inbound:
- port: 15000
servicePort: 5000
serviceAddress: 127.0.0.1
tags:
kuma.io/service: app
kuma.io/protocol: http