Skip to content

Commit

Permalink
docs: add TCP guide examples for traffic matching
Browse files Browse the repository at this point in the history
  • Loading branch information
shaneutt committed Jan 4, 2022
1 parent e3b9ec0 commit dbf2e9a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/v1alpha2/traffic-matching-tcp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TCPRoute
metadata:
name: traffic-matching-example
spec:
rules:
- matches:
- sourceAddresses:
- value: "192.168.1.1"
- value: "FE80::0202:B3FF:FE1E:8329"
destinationAddresses:
- value: "10.96.0.1"
backendRefs:
- name: my-service
port: 8080
16 changes: 16 additions & 0 deletions site-src/v1alpha2/guides/tcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ In this way each `TCPRoute` "attaches" itself to a different port on the
`Gateway` so that the service `my-foo-service` is taking traffic for port `8080`
from outside the cluster and `my-bar-service` takes the port `8090` traffic.

## Alternatives: Routing Using Traffic Matching

In addition to simply matching traffic based on a Gateway's listeners (as seen
in the above examples) a `TCPRoute` can also match further on the traffic bound
for that listener:

```
{% include 'v1alpha2/traffic-matching-tcp.yaml' %}
```

In the above example the `matches` option for the `TCPRoute` rules enables the
route to only serve the traffic that matches specified destination and/or source
address patterns. In this way separate `TCPRoute` objects can be responsible
for routing different traffic on the same `Gateway` listener and can enable
significant flexibility for pure TCP routing.

## Alternatives: TCP Traffic Routing Using Metadata

While in the above examples we mainly focused on routing by port, it is also
Expand Down

0 comments on commit dbf2e9a

Please sign in to comment.