Skip to content

Commit 3189e1f

Browse files
authored
Merge branch 'MicrosoftDocs:main' into cosmos-nosql-query-geospatial
2 parents 4ed004e + e214547 commit 3189e1f

24 files changed

+1127
-699
lines changed

articles/application-gateway/for-containers/how-to-backend-mtls-gateway-api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ ms.author: greglin
1313

1414
# Backend MTLS with Application Gateway for Containers - Gateway API (preview)
1515

16-
This document helps set up an example application that uses the following resources from Gateway API:
17-
- [Gateway](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gateway) - creating a gateway with one https listener
18-
- [HTTPRoute](https://gateway-api.sigs.k8s.io/v1alpha2/api-types/httproute/) - creating an HTTP route that references a backend service
19-
- [BackendTLSPolicy](api-specification-kubernetes.md#alb.networking.azure.io/v1.BackendTLSPolicy) - creating a backend TLS policy that has a client and CA certificate for the backend service referenced in the HTTPRoute
16+
This document helps set up an example application that uses the following resources from Gateway API. Steps are provided to:
17+
- Create a [Gateway](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gateway) resource with one HTTPS listener.
18+
- Create an [HTTPRoute](https://gateway-api.sigs.k8s.io/v1alpha2/api-types/httproute/) resource that references a backend service.
19+
- Create a [BackendTLSPolicy](api-specification-kubernetes.md#alb.networking.azure.io/v1.BackendTLSPolicy) resource that has a client and CA certificate for the backend service referenced in the HTTPRoute.
2020

2121
## Prerequisites
2222

Lines changed: 313 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,313 @@
1+
---
2+
title: Multiple site hosting with Application Gateway for Containers - Gateway API (preview)
3+
description: Learn how to host multiple sites with Application Gateway for Containers using the Gateway API.
4+
services: application-gateway
5+
author: greglin
6+
ms.service: application-gateway
7+
ms.subservice: appgw-for-containers
8+
ms.topic: how-to
9+
ms.date: 07/31/2023
10+
ms.author: greglin
11+
---
12+
13+
# Multiple site hosting with Application Gateway for Containers - Gateway API (preview)
14+
15+
This document helps you set up an example application that uses the resources from Gateway API to demonstrate hosting multiple sites on the same Kubernetes Gateway resource / Application Gateway for Containers frontend. Steps are provided to:
16+
- Create a [Gateway](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gateway) resource with one HTTP listener.
17+
- Create two [HTTPRoute](https://gateway-api.sigs.k8s.io/v1alpha2/api-types/httproute/) resources that each reference a unique backend service.
18+
19+
## Prerequisites
20+
21+
> [!IMPORTANT]
22+
> Application Gateway for Containers is currently in PREVIEW.<br>
23+
> See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.
24+
25+
1. If you follow the BYO deployment strategy, ensure you have set up your Application Gateway for Containers resources and [ALB Controller](quickstart-deploy-application-gateway-for-containers-alb-controller.md)
26+
2. If you follow the ALB managed deployment strategy, ensure you have provisioned your [ALB Controller](quickstart-deploy-application-gateway-for-containers-alb-controller.md) and provisioned the Application Gateway for Containers resources via the [ApplicationLoadBalancer custom resource](quickstart-create-application-gateway-for-containers-managed-by-alb-controller.md).
27+
3. Deploy sample HTTP application
28+
Apply the following deployment.yaml file on your cluster to create a sample web application to demonstrate path, query, and header based routing.
29+
```bash
30+
kubectl apply -f https://trafficcontrollerdocs.blob.core.windows.net/examples/traffic-split-scenario/deployment.yaml
31+
```
32+
33+
This command creates the following on your cluster:
34+
- a namespace called `test-infra`
35+
- 2 services called `backend-v1` and `backend-v2` in the `test-infra` namespace
36+
- 2 deployments called `backend-v1` and `backend-v2` in the `test-infra` namespace
37+
38+
## Deploy the required Gateway API resources
39+
40+
# [ALB managed deployment](#tab/alb-managed)
41+
42+
1. Create a Gateway
43+
```bash
44+
kubectl apply -f - <<EOF
45+
apiVersion: gateway.networking.k8s.io/v1beta1
46+
kind: Gateway
47+
metadata:
48+
name: gateway-01
49+
namespace: test-infra
50+
annotations:
51+
alb.networking.azure.io/alb-namespace: alb-test-infra
52+
alb.networking.azure.io/alb-name: alb-test
53+
spec:
54+
gatewayClassName: azure-alb-external
55+
listeners:
56+
- name: http-listener
57+
port: 80
58+
protocol: HTTP
59+
allowedRoutes:
60+
namespaces:
61+
from: Same
62+
EOF
63+
```
64+
65+
66+
# [Bring your own (BYO) deployment](#tab/byo)
67+
68+
1. Set the following environment variables
69+
70+
```bash
71+
RESOURCE_GROUP='<resource group name of the Application Gateway For Containers resource>'
72+
RESOURCE_NAME='alb-test'
73+
74+
RESOURCE_ID=$(az network alb show --resource-group $RESOURCE_GROUP --name $RESOURCE_NAME --query id -o tsv)
75+
FRONTEND_NAME='frontend'
76+
```
77+
78+
2. Create a Gateway
79+
```bash
80+
kubectl apply -f - <<EOF
81+
apiVersion: gateway.networking.k8s.io/v1beta1
82+
kind: Gateway
83+
metadata:
84+
name: gateway-01
85+
namespace: test-infra
86+
annotations:
87+
alb.networking.azure.io/alb-id: $RESOURCE_ID
88+
spec:
89+
gatewayClassName: azure-alb-external
90+
listeners:
91+
- name: http-listener
92+
port: 80
93+
protocol: HTTP
94+
allowedRoutes:
95+
namespaces:
96+
from: Same
97+
addresses:
98+
- type: alb.networking.azure.io/alb-frontend
99+
value: $FRONTEND_NAME
100+
EOF
101+
```
102+
103+
---
104+
105+
Once the gateway resource has been created, ensure the status is valid, the listener is _Programmed_, and an address is assigned to the gateway.
106+
```bash
107+
kubectl get gateway gateway-01 -n test-infra -o yaml
108+
```
109+
110+
Example output of successful gateway creation.
111+
```yaml
112+
status:
113+
addresses:
114+
- type: IPAddress
115+
value: xxxx.yyyy.alb.azure.com
116+
conditions:
117+
- lastTransitionTime: "2023-06-19T21:04:55Z"
118+
message: Valid Gateway
119+
observedGeneration: 1
120+
reason: Accepted
121+
status: "True"
122+
type: Accepted
123+
- lastTransitionTime: "2023-06-19T21:04:55Z"
124+
message: Application Gateway For Containers resource has been successfully updated.
125+
observedGeneration: 1
126+
reason: Programmed
127+
status: "True"
128+
type: Programmed
129+
listeners:
130+
- attachedRoutes: 0
131+
conditions:
132+
- lastTransitionTime: "2023-06-19T21:04:55Z"
133+
message: ""
134+
observedGeneration: 1
135+
reason: ResolvedRefs
136+
status: "True"
137+
type: ResolvedRefs
138+
- lastTransitionTime: "2023-06-19T21:04:55Z"
139+
message: Listener is accepted
140+
observedGeneration: 1
141+
reason: Accepted
142+
status: "True"
143+
type: Accepted
144+
- lastTransitionTime: "2023-06-19T21:04:55Z"
145+
message: Application Gateway For Containers resource has been successfully updated.
146+
observedGeneration: 1
147+
reason: Programmed
148+
status: "True"
149+
type: Programmed
150+
name: https-listener
151+
supportedKinds:
152+
- group: gateway.networking.k8s.io
153+
kind: HTTPRoute
154+
```
155+
156+
Once the gateway has been created, create two HTTPRoute resources for `contoso.com` and `fabrikam.com` domain names. Each domain forwards traffic to a different backend service.
157+
```bash
158+
kubectl apply -f - <<EOF
159+
apiVersion: gateway.networking.k8s.io/v1beta1
160+
kind: HTTPRoute
161+
metadata:
162+
name: contoso-route
163+
namespace: test-infra
164+
spec:
165+
parentRefs:
166+
- name: gateway-01
167+
hostnames:
168+
- "contoso.com"
169+
rules:
170+
- backendRefs:
171+
- name: backend-v1
172+
port: 8080
173+
---
174+
apiVersion: gateway.networking.k8s.io/v1beta1
175+
kind: HTTPRoute
176+
metadata:
177+
name: fabrikam-route
178+
namespace: test-infra
179+
spec:
180+
parentRefs:
181+
- name: gateway-01
182+
hostnames:
183+
- "fabrikam.com"
184+
rules:
185+
- backendRefs:
186+
- name: backend-v2
187+
port: 8080
188+
EOF
189+
```
190+
191+
Once the HTTPRoute resource has been created, ensure both HTTPRoute resources show _Accepted_ and the Application Gateway for Containers resource has been _Programmed_.
192+
```bash
193+
kubectl get httproute contoso-route -n test-infra -o yaml
194+
kubectl get httproute fabrikam-route -n test-infra -o yaml
195+
```
196+
197+
Verify the status of the Application Gateway for Containers resource has been successfully updated for each HTTPRoute.
198+
199+
```yaml
200+
status:
201+
parents:
202+
- conditions:
203+
- lastTransitionTime: "2023-06-19T22:18:23Z"
204+
message: ""
205+
observedGeneration: 1
206+
reason: ResolvedRefs
207+
status: "True"
208+
type: ResolvedRefs
209+
- lastTransitionTime: "2023-06-19T22:18:23Z"
210+
message: Route is Accepted
211+
observedGeneration: 1
212+
reason: Accepted
213+
status: "True"
214+
type: Accepted
215+
- lastTransitionTime: "2023-06-19T22:18:23Z"
216+
message: Application Gateway For Containers resource has been successfully updated.
217+
observedGeneration: 1
218+
reason: Programmed
219+
status: "True"
220+
type: Programmed
221+
controllerName: alb.networking.azure.io/alb-controller
222+
parentRef:
223+
group: gateway.networking.k8s.io
224+
kind: Gateway
225+
name: gateway-01
226+
namespace: test-infra
227+
```
228+
229+
## Test access to the application
230+
231+
Now we're ready to send some traffic to our sample application, via the FQDN assigned to the frontend. Use the following command to get the FQDN.
232+
233+
```bash
234+
fqdn=$(kubectl get gateway gateway-01 -n test-infra -o jsonpath='{.status.addresses[0].value}')
235+
```
236+
237+
Specifying server name indicator using the curl command, `contoso.com` for the frontend FQDN should return a response from the backend-v1 service.
238+
239+
```bash
240+
fqdnIp=$(dig +short $fqdn)
241+
curl -k --resolve contoso.com:80:$fqdnIp http://contoso.com
242+
```
243+
244+
Via the response we should see:
245+
```json
246+
{
247+
"path": "/",
248+
"host": "contoso.com",
249+
"method": "GET",
250+
"proto": "HTTP/1.1",
251+
"headers": {
252+
"Accept": [
253+
"*/*"
254+
],
255+
"User-Agent": [
256+
"curl/7.81.0"
257+
],
258+
"X-Forwarded-For": [
259+
"xxx.xxx.xxx.xxx"
260+
],
261+
"X-Forwarded-Proto": [
262+
"http"
263+
],
264+
"X-Request-Id": [
265+
"dcd4bcad-ea43-4fb6-948e-a906380dcd6d"
266+
]
267+
},
268+
"namespace": "test-infra",
269+
"ingress": "",
270+
"service": "",
271+
"pod": "backend-v1-5b8fd96959-f59mm"
272+
}
273+
```
274+
275+
Specifying server name indicator using the curl command, `contoso.com` for the frontend FQDN should return a response from the backend-v1 service.
276+
277+
```bash
278+
fqdnIp=$(dig +short $fqdn)
279+
curl -k --resolve fabrikam.com:80:$fqdnIp http://fabrikam.com
280+
```
281+
282+
Via the response we should see:
283+
```json
284+
{
285+
"path": "/",
286+
"host": "fabrikam.com",
287+
"method": "GET",
288+
"proto": "HTTP/1.1",
289+
"headers": {
290+
"Accept": [
291+
"*/*"
292+
],
293+
"User-Agent": [
294+
"curl/7.81.0"
295+
],
296+
"X-Forwarded-For": [
297+
"xxx.xxx.xxx.xxx"
298+
],
299+
"X-Forwarded-Proto": [
300+
"http"
301+
],
302+
"X-Request-Id": [
303+
"adae8cc1-8030-4d95-9e05-237dd4e3941b"
304+
]
305+
},
306+
"namespace": "test-infra",
307+
"ingress": "",
308+
"service": "",
309+
"pod": "backend-v2-594bd59865-ppv9w"
310+
}
311+
```
312+
313+
Congratulations, you have installed ALB Controller, deployed a backend application and routed traffic to two different backend services via different hostnames via Gateway API on Application Gateway for Containers.

articles/application-gateway/for-containers/how-to-path-header-query-string-routing-gateway-api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ ms.author: greglin
1212

1313
# Path, header, and query string routing with Application Gateway for Containers - Gateway API (preview)
1414

15-
This document helps you set up an example application that uses the resources from Gateway API to demonstrate traffic routing based on URL path, query string, and header. Review the following gateway API resources for more information:
16-
- [Gateway](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gateway) - create a gateway with one HTTPS listener.
17-
- [HTTPRoute](https://gateway-api.sigs.k8s.io/v1alpha2/api-types/httproute/) - create an HTTP route that references a backend service.
18-
- [HTTPRouteMatch](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.HTTPRouteMatch) - Use `matches` to route based on path, header, and query string.
15+
This document helps you set up an example application that uses the resources from Gateway API to demonstrate traffic routing based on URL path, query string, and header. Steps are provided to:
16+
- Create a [Gateway](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gateway) resource with one HTTPS listener.
17+
- Create an [HTTPRoute](https://gateway-api.sigs.k8s.io/v1alpha2/api-types/httproute/) resource that references a backend service.
18+
- Use [HTTPRouteMatch](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.HTTPRouteMatch) to perform `matches` that route based on path, header, and query string.
1919

2020
## Prerequisites
2121

articles/application-gateway/for-containers/how-to-ssl-offloading-gateway-api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ ms.author: greglin
1313

1414
# SSL offloading with Application Gateway for Containers - Gateway API (preview)
1515

16-
This document helps set up an example application that uses the following resources from Gateway API:
17-
- [Gateway](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gateway) - creating a gateway with one https listener
18-
- [HTTPRoute](https://gateway-api.sigs.k8s.io/v1alpha2/api-types/httproute/) - creating an HTTP route that references a backend service
16+
This document helps set up an example application that uses the following resources from Gateway API. Steps are provided to:
17+
- Create a [Gateway](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gateway) resource with one HTTPS listener.
18+
- Create an [HTTPRoute](https://gateway-api.sigs.k8s.io/v1alpha2/api-types/httproute/) that references a backend service.
1919

2020
## Prerequisites
2121

articles/application-gateway/for-containers/how-to-ssl-offloading-ingress-api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ This document helps set up an example application that uses the _Ingress_ resour
2121
> Application Gateway for Containers is currently in PREVIEW.<br>
2222
> See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.
2323
24-
1. If following the BYO deployment strategy, ensure you have set up your Application Gateway for Containers resources and [ALB Controller](quickstart-deploy-application-gateway-for-containers-alb-controller.md)
25-
2. If following the ALB managed deployment strategy, ensure you have provisioned your [ALB Controller](quickstart-deploy-application-gateway-for-containers-alb-controller.md) and provisioned the Application Gateway for Containers resources via the [ApplicationLoadBalancer custom resource](quickstart-create-application-gateway-for-containers-managed-by-alb-controller.md).
26-
3. Deploy sample HTTPS application
24+
1. If you follow the BYO deployment strategy, ensure you have set up your Application Gateway for Containers resources and [ALB Controller](quickstart-deploy-application-gateway-for-containers-alb-controller.md)
25+
2. If you follow the ALB managed deployment strategy, ensure you have provisioned your [ALB Controller](quickstart-deploy-application-gateway-for-containers-alb-controller.md) and provisioned the Application Gateway for Containers resources via the [ApplicationLoadBalancer custom resource](quickstart-create-application-gateway-for-containers-managed-by-alb-controller.md).
26+
3. Deploy a sample HTTPS application:
2727
Apply the following deployment.yaml file on your cluster to create a sample web application to demonstrate TLS/SSL offloading.
2828

2929
```bash

articles/application-gateway/for-containers/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
items:
3535
- name: Backend MTLS
3636
href: how-to-backend-mtls-gateway-api.md
37+
- name: Multiple site hosting
38+
href: how-to-multiple-site-hosting-gateway-api.md
3739
- name: Path, header, and query string based routing
3840
href: how-to-path-header-query-string-routing-gateway-api.md
3941
- name: SSL Offloading

0 commit comments

Comments
 (0)