Skip to content

Commit c416ec4

Browse files
committed
Change note wording and code block white spaces
1 parent 7dadd39 commit c416ec4

File tree

1 file changed

+111
-111
lines changed

1 file changed

+111
-111
lines changed

examples/grpc-routing/README.md

+111-111
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,46 @@ to route traffic to that application using GRPCRoute resources.
88
## 1. Deploy NGINX Gateway Fabric
99

1010
1. Follow the [installation instructions](https://docs.nginx.com/nginx-gateway-fabric/installation/) to deploy NGINX Gateway Fabric.
11-
NB: Ensure the Gateway APIs from the experimental channel are installed and that NGF is deployed with the Gateway experimental features enabled.
11+
> **Important**: Ensure the Gateway APIs from the experimental channel are installed and that NGF is deployed with the Gateway experimental features enabled.
1212
1313
1. Save the public IP address of NGINX Gateway Fabric into a shell variable:
1414

15-
```text
16-
GW_IP=XXX.YYY.ZZZ.III
17-
```
15+
```text
16+
GW_IP=XXX.YYY.ZZZ.III
17+
```
1818
1919
1. Save the port of NGINX Gateway Fabric:
2020
21-
```text
22-
GW_PORT=<port number>
23-
```
21+
```text
22+
GW_PORT=<port number>
23+
```
2424
2525
## 2. Deploy the Helloworld Application
2626
2727
1. Create the two helloworld Deployments and Services:
2828
29-
```shell
30-
kubectl apply -f helloworld.yaml
31-
```
29+
```shell
30+
kubectl apply -f helloworld.yaml
31+
```
3232
3333
1. Check that the Pods are running in the `default` Namespace:
3434
35-
```shell
36-
kubectl -n default get pods
37-
```
35+
```shell
36+
kubectl -n default get pods
37+
```
3838
39-
```text
40-
NAME READY STATUS RESTARTS AGE
41-
grpc-infra-backend-v1-766c7d6788-rg92p 1/1 Running 0 12s
42-
grpc-infra-backend-v2-546f7c8d48-mjkkx 1/1 Running 0 12s
43-
```
39+
```text
40+
NAME READY STATUS RESTARTS AGE
41+
grpc-infra-backend-v1-766c7d6788-rg92p 1/1 Running 0 12s
42+
grpc-infra-backend-v2-546f7c8d48-mjkkx 1/1 Running 0 12s
43+
```
4444
4545
Save these pod names into variables:
4646
47-
```text
48-
POD_V1=<grpc-infra-backend-v1-xxxxxxxxxx-xxxxx>
49-
POD_V2=<grpc-infra-backend-v2-xxxxxxxxxx-xxxxx>
50-
```
47+
```text
48+
POD_V1=<grpc-infra-backend-v1-xxxxxxxxxx-xxxxx>
49+
POD_V2=<grpc-infra-backend-v2-xxxxxxxxxx-xxxxx>
50+
```
5151
5252
## 3. Configure Routing
5353
@@ -57,147 +57,147 @@ There are 3 options to configure gRPC routing. To access the application and tes
5757
5858
1. Create the Gateway and GRPCRoute resources:
5959
60-
```shell
61-
kubectl apply -f exact-method.yaml
62-
```
60+
```shell
61+
kubectl apply -f exact-method.yaml
62+
```
6363
6464
2. Test the Application:
6565
66-
```shell
67-
grpcurl -plaintext -proto grpc.proto -authority bar.com -d '{"name": "exact"}' ${GW_IP}:${GW_PORT} helloworld.Greeter/SayHello
68-
```
66+
```shell
67+
grpcurl -plaintext -proto grpc.proto -authority bar.com -d '{"name": "exact"}' ${GW_IP}:${GW_PORT} helloworld.Greeter/SayHello
68+
```
6969
70-
```text
71-
{
72-
"message": "Hello exact"
73-
}
74-
```
70+
```text
71+
{
72+
"message": "Hello exact"
73+
}
74+
```
7575
7676
3. Clean up the Gateway and GRPCRoute resources:
7777
78-
```shell
79-
kubectl delete -f exact-method.yaml
80-
```
78+
```shell
79+
kubectl delete -f exact-method.yaml
80+
```
8181
8282
### 3b. Configure hostname based routing
8383
8484
1. Create the Gateway and GRPCRoute resources:
8585
86-
```shell
87-
kubectl apply -f hostname.yaml
88-
```
86+
```shell
87+
kubectl apply -f hostname.yaml
88+
```
8989
9090
2. Test the Application:
9191
92-
```shell
93-
grpcurl -plaintext -proto grpc.proto -authority bar.com -d '{"name": "bar server"}' ${GW_IP}:${GW_PORT} helloworld.Greeter/SayHello
94-
```
92+
```shell
93+
grpcurl -plaintext -proto grpc.proto -authority bar.com -d '{"name": "bar server"}' ${GW_IP}:${GW_PORT} helloworld.Greeter/SayHello
94+
```
9595
96-
```text
97-
{
98-
"message": "Hello bar server"
99-
}
100-
```
96+
```text
97+
{
98+
"message": "Hello bar server"
99+
}
100+
```
101101
102102
To make sure this came from the correct server, we can check the application server logs:
103103
104-
```shell
105-
kubectl logs ${POD_V1}
106-
```
104+
```shell
105+
kubectl logs ${POD_V1}
106+
```
107107
108-
```text
109-
2024/04/29 09:26:54 server listening at [::]:50051
110-
2024/04/29 09:28:54 Received: bar server
111-
```
108+
```text
109+
2024/04/29 09:26:54 server listening at [::]:50051
110+
2024/04/29 09:28:54 Received: bar server
111+
```
112112
113113
Now we'll send a request to `foo.bar.com`
114114
115-
```shell
116-
grpcurl -plaintext -proto grpc.proto -authority foo.bar.com -d '{"name": "foo bar server"}' ${GW_IP}:${GW_PORT} helloworld.Greeter/SayHello
117-
```
115+
```shell
116+
grpcurl -plaintext -proto grpc.proto -authority foo.bar.com -d '{"name": "foo bar server"}' ${GW_IP}:${GW_PORT} helloworld.Greeter/SayHello
117+
```
118118
119-
```text
120-
{
121-
"message": "Hello foo bar server"
122-
}
123-
```
119+
```text
120+
{
121+
"message": "Hello foo bar server"
122+
}
123+
```
124124
125125
This time, we'll check the POD_V2 logs:
126126
127-
```shell
128-
kubectl logs ${POD_V2}
129-
```
127+
```shell
128+
kubectl logs ${POD_V2}
129+
```
130130
131-
```text
132-
2024/04/29 09:26:55 server listening at [::]:50051
133-
2024/04/29 09:29:46 Received: foo bar server
134-
```
131+
```text
132+
2024/04/29 09:26:55 server listening at [::]:50051
133+
2024/04/29 09:29:46 Received: foo bar server
134+
```
135135
136136
3. Clean up the Gateway and GRPCRoute resources:
137137
138-
```shell
139-
kubectl delete -f hostname.yaml
140-
```
138+
```shell
139+
kubectl delete -f hostname.yaml
140+
```
141141
142142
### 3c. Configure headers based routing
143143
144144
1. Create the Gateway and GRPCRoute resources:
145145
146-
```shell
147-
kubectl apply -f headers.yaml
148-
```
146+
```shell
147+
kubectl apply -f headers.yaml
148+
```
149149
150150
2. Test the Application:
151151
152-
```shell
153-
grpcurl -plaintext -proto grpc.proto -authority bar.com -d '{"name": "version one"}' -H 'version: one' ${GW_IP}:${GW_PORT} helloworld.Greeter/SayHello
154-
```
152+
```shell
153+
grpcurl -plaintext -proto grpc.proto -authority bar.com -d '{"name": "version one"}' -H 'version: one' ${GW_IP}:${GW_PORT} helloworld.Greeter/SayHello
154+
```
155155
156-
```text
157-
{
158-
"message": "Hello version one"
159-
}
160-
```
156+
```text
157+
{
158+
"message": "Hello version one"
159+
}
160+
```
161161
162162
To make sure this came from the correct server, we can check the application server logs:
163163
164-
```shell
165-
kubectl logs ${POD_V1}
166-
```
164+
```shell
165+
kubectl logs ${POD_V1}
166+
```
167167
168-
```text
169-
<...>
170-
2024/04/29 09:30:27 Received: version one
171-
```
168+
```text
169+
<...>
170+
2024/04/29 09:30:27 Received: version one
171+
```
172172
173173
Now we'll send a request with the header `version: two`
174174
175-
```shell
176-
grpcurl -plaintext -proto grpc.proto -authority bar.com -d '{"name": "version two"}' -H 'version: two' ${GW_IP}:${GW_PORT} helloworld.Greeter/SayHello
177-
```
175+
```shell
176+
grpcurl -plaintext -proto grpc.proto -authority bar.com -d '{"name": "version two"}' -H 'version: two' ${GW_IP}:${GW_PORT} helloworld.Greeter/SayHello
177+
```
178178
179-
```text
180-
{
181-
"message": "Hello version two"
182-
}
183-
```
179+
```text
180+
{
181+
"message": "Hello version two"
182+
}
183+
```
184184
185185
This time, we'll check the POD_V2 logs:
186186
187-
```shell
188-
kubectl logs ${POD_V2}
189-
```
187+
```shell
188+
kubectl logs ${POD_V2}
189+
```
190190
191-
```text
192-
<...>
193-
2024/04/29 09:32:46 Received: version two
194-
```
191+
```text
192+
<...>
193+
2024/04/29 09:32:46 Received: version two
194+
```
195195
196196
Finally, we'll send a request with the headers `version: two` and `color: orange`
197197
198-
```shell
199-
grpcurl -plaintext -proto grpc.proto -authority bar.com -d '{"name": "version two orange"}' -H 'version: two' -H 'color: orange' ${GW_IP}:${GW_PORT} helloworld.Greeter/SayHello
200-
```
198+
```shell
199+
grpcurl -plaintext -proto grpc.proto -authority bar.com -d '{"name": "version two orange"}' -H 'version: two' -H 'color: orange' ${GW_IP}:${GW_PORT} helloworld.Greeter/SayHello
200+
```
201201
202202
```text
203203
{
@@ -219,6 +219,6 @@ There are 3 options to configure gRPC routing. To access the application and tes
219219

220220
3. Clean up the Gateway and GRPCRoute resources:
221221

222-
```shell
223-
kubectl delete -f headers.yaml
224-
```
222+
```shell
223+
kubectl delete -f headers.yaml
224+
```

0 commit comments

Comments
 (0)