You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal is to create a set of rules that will result in client requests being sent to specific backends based on the request attributes. In this diagram, we have two versions of the `coffee` service. Traffic for v1 needs to be directed to the old application, while traffic for v2 needs to be directed towards the new application. We also have two `tea` services, one that handles GET operations and one that handles POST operations. Both the `tea` and `coffee` applications share the same Gateway.
Copy file name to clipboardExpand all lines: content/ngf/traffic-management/basic-routing.md
+93-3Lines changed: 93 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,21 @@ You can route traffic to your Kubernetes applications using the Gateway API and
21
21
22
22
The application we are going to use in this guide is a simple **coffee** application comprised of one service and two pods:
23
23
24
-
{{<imgsrc="ngf/img/route-all-traffic-app.png"alt="This image shows a single 'coffee' Service connecting to two 'coffee' Pods.">}}
24
+
```mermaid
25
+
graph TB
26
+
subgraph cluster [Kubernetes Cluster]
27
+
style cluster fill:#FFFFFF,stroke:#000000
28
+
svc[Service<br>coffee]
29
+
pod1[Pod<br>coffee]
30
+
pod2[Pod<br>coffee]
31
+
end
32
+
33
+
svc --> pod1 & pod2
34
+
35
+
class pod1,pod2,svc appNode
36
+
classDef appNode fill:#edbd8c,stroke:#D9822B
37
+
38
+
```
25
39
26
40
Using this architecture, the **coffee** application is not accessible outside the cluster. We want to expose this application on the hostname "cafe.example.com" so that clients outside the cluster can access it.
To route traffic to the **coffee** application, we will create a Gateway and HTTPRoute. The following diagram shows the configuration we are creating in the next step:
We need a Gateway to create an entry point for HTTP traffic coming into the cluster. The **cafe** Gateway we are going to create will open an entry point to the cluster on port 80 for HTTP traffic.
102
158
103
159
To route HTTP traffic from the Gateway to the **coffee** service, we need to create an HTTPRoute named **coffee** and attach it to the Gateway. This HTTPRoute will have a single routing rule that routes all traffic to the hostname "cafe.example.com" from the Gateway to the **coffee** service.
104
160
105
161
Once NGINX Gateway Fabric processes the **cafe** Gateway and **coffee** HTTPRoute, it will configure a data plane (NGINX) to route all HTTP requests sent to "cafe.example.com" to the pods that the **coffee** service targets:
0 commit comments