|
1 | 1 | ---
|
2 |
| -title: How to configure ingress for Azure Spring Apps |
3 |
| -description: Describes how to configure ingress for Azure Spring Apps. |
| 2 | +title: Customize the ingress configuration in Azure Spring Apps |
| 3 | +description: Learn how to customize the ingress configuration in Azure Spring Apps. |
4 | 4 | author: KarlErickson
|
5 | 5 | ms.author: haital
|
6 | 6 | ms.service: spring-apps
|
7 | 7 | ms.topic: how-to
|
8 |
| -ms.date: 05/27/2022 |
| 8 | +ms.date: 09/29/2022 |
9 | 9 | ms.custom: devx-track-java, devx-track-azurecli
|
10 | 10 | ---
|
11 | 11 |
|
12 | 12 | # Customize the ingress configuration in Azure Spring Apps
|
13 | 13 |
|
14 | 14 | **This article applies to:** ✔️ Basic/Standard tier ✔️ Enterprise tier
|
15 | 15 |
|
16 |
| -This article shows you how to set and update the ingress configuration in Azure Spring Apps by using the Azure portal and Azure CLI. |
| 16 | +This article shows you how to set and update an application's ingress settings in Azure Spring Apps by using the Azure portal and Azure CLI. |
17 | 17 |
|
18 |
| -The Azure Spring Apps service uses an underlying ingress controller to handle application traffic management. Currently, the following ingress setting is supported for customization. |
| 18 | +The Azure Spring Apps service uses an underlying ingress controller to handle application traffic management. The following ingress settings are supported for customization. |
19 | 19 |
|
20 |
| -| Name | Ingress setting | Default value | Valid range | Description | |
21 |
| -|----------------------|--------------------|---------------|-------------|----------------------------------------------------------------------| |
22 |
| -| ingress-read-timeout | proxy-read-timeout | 300 | \[1,1800\] | The timeout in seconds for reading a response from a proxied server. | |
| 20 | +| Name | Ingress setting | Default value | Valid range | Description | |
| 21 | +|----------------------|------------------------|---------------|-------------------|--------------------------------------------------------------------------| |
| 22 | +| `ingress-read-timeout` | `proxy-read-timeout` | 300 | \[1,1800\] | The timeout in seconds for reading a response from a proxied server. | |
| 23 | +| `ingress-send-timeout` | `proxy-send-timeout` | 60 | \[1,1800\] | The timeout in seconds for transmitting a request to the proxied server. | |
| 24 | +| `session-affinity` | `affinity` | None | Session, None | The type of the affinity that will make the request come to the same pod replica that was responding to the previous request. Set `session-affinity` to Cookie to enable session affinity. In the portal only, you must choose the enable session affinity box. | |
| 25 | +| `session-max-age` | `session-cookie-max-age` | 0 | \[0,7 days\] | The time in seconds until the cookie expires, corresponding to the `Max-Age` cookie directive. If you set `session-max-age` to 0, the expiration period is equal to the browser session period. | |
| 26 | +| `backend-protocol` | `backend-protocol` | Default | DefaultGRPC | Sets the backend protocol to indicate how NGINX should communicate with the backend service. Default means HTTP/HTTPS/WebSocket. The `backend-protocol` setting only applies to client-to-app traffic. For app-to-app traffic within the same service instance, choose any protocol for app-to-app traffic without modifying the `backend-protocol` setting. The protocol doesn't restrict your choice of protocol for app-to-app traffic within the same service instance. | |
23 | 27 |
|
24 | 28 | ## Prerequisites
|
25 | 29 |
|
26 |
| -- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
27 |
| -- [The Azure CLI](/cli/azure/install-azure-cli). |
28 |
| -- The Azure Spring Apps extension. Use the following command to remove previous versions and install the latest extension. If you previously installed the spring-cloud extension, uninstall it to avoid configuration and version mismatches. |
| 30 | +- An Azure subscription. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin. |
| 31 | +- [Azure CLI](/cli/azure/install-azure-cli) with the Azure Spring Apps extension. Use the following command to remove previous versions and install the latest extension. If you previously installed the spring-cloud extension, uninstall it to avoid configuration and version mismatches. |
29 | 32 |
|
30 | 33 | ```azurecli
|
31 | 34 | az extension remove --name spring
|
32 | 35 | az extension add --name spring
|
33 | 36 | az extension remove --name spring-cloud
|
34 | 37 | ```
|
35 | 38 |
|
36 |
| -## Set the ingress configuration when creating a service |
| 39 | +## Set the ingress configuration |
37 | 40 |
|
38 |
| -You can set the ingress configuration when creating a service by using the following CLI command. |
| 41 | +Use the following Azure CLI command to set the ingress configuration when you create. |
39 | 42 |
|
40 | 43 | ```azurecli
|
41 |
| -az spring create \ |
| 44 | +az spring app create \ |
42 | 45 | --resource-group <resource-group-name> \
|
| 46 | + --service <service-name> \ |
43 | 47 | --name <service-name> \
|
44 |
| - --ingress-read-timeout 300 |
| 48 | + --ingress-read-timeout 300 \ |
| 49 | + --ingress-send-timeout 60 \ |
| 50 | + --session-affinity Cookie \ |
| 51 | + --session-max-age 1800 \ |
| 52 | + --backend-protocol Default \ |
45 | 53 | ```
|
46 | 54 |
|
47 |
| -This command will create a service with ingress read timeout set to 300 seconds. |
| 55 | +This command creates an app with the following settings: |
48 | 56 |
|
49 |
| -## Update the ingress configuration for an existing service |
| 57 | +- Ingress read timeout: 300 seconds |
| 58 | +- Ingress send timeout: 60 seconds |
| 59 | +- Session affinity: Cookie |
| 60 | +- Session cookie max age: 1800 seconds |
| 61 | +- Backend protocol: Default |
| 62 | + |
| 63 | +## Update the ingress settings for an existing app |
50 | 64 |
|
51 | 65 | ### [Azure portal](#tab/azure-portal)
|
52 | 66 |
|
53 |
| -To update the ingress configuration for an existing service, use the following steps: |
| 67 | +Use the following steps to update the ingress settings for an application hosted by an existing service instance. |
54 | 68 |
|
55 | 69 | 1. Sign in to the portal using an account associated with the Azure subscription that contains the Azure Spring Apps instance.
|
56 |
| -2. Navigate to the **Networking** pane, then select the **Ingress configuration** tab. |
57 |
| -3. Update the ingress configuration, and then select **Save**. |
| 70 | +1. Navigate to the **Apps** pane, and then select the app you want to configure. |
| 71 | +1. Navigate to the **Configuration** pane, and then select the **Ingress settings** tab. |
| 72 | +1. Update the ingress settings, and then select **Save**. |
58 | 73 |
|
59 |
| - :::image type="content" source="media/how-to-configure-ingress/config-ingress-read-timeout.png" lightbox="media/how-to-configure-ingress/config-ingress-read-timeout.png" alt-text="Screenshot of Azure portal example for config ingress read timeout."::: |
| 74 | + :::image type="content" source="media/how-to-configure-ingress/ingress-settings.jpg" lightbox="media/how-to-configure-ingress/ingress-settings.jpg" alt-text="Screenshot of Azure portal Configuration page showing the Ingress settings tab."::: |
60 | 75 |
|
61 | 76 | ### [Azure CLI](#tab/azure-cli)
|
62 | 77 |
|
63 |
| -To update the ingress configuration for an existing service, use the following command: |
| 78 | +Use the following command to update the ingress settings for an existing app. |
64 | 79 |
|
65 | 80 | ```azurecli
|
66 |
| -az spring update \ |
| 81 | +az spring app update \ |
67 | 82 | --resource-group <resource-group-name> \
|
| 83 | + --service <service-name> \ |
68 | 84 | --name <service-name> \
|
69 |
| - --ingress-read-timeout 600 |
| 85 | + --ingress-read-timeout 600 \ |
| 86 | + --ingress-send-timeout 600 \ |
| 87 | + --session-affinity None \ |
| 88 | + --session-max-age 0 \ |
| 89 | + --backend-protocol GRPC \ |
70 | 90 | ```
|
71 | 91 |
|
72 |
| -This command will update the ingress read timeout to 600 seconds. |
| 92 | +This command updates the app with the following settings: |
| 93 | + |
| 94 | +- Ingress read timeout: 600 seconds |
| 95 | +- Ingress send timeout: 600 seconds |
| 96 | +- Session affinity: None |
| 97 | +- Session cookie max age: 0 |
| 98 | +- Backend protocol: GRPC |
| 99 | + |
| 100 | +--- |
| 101 | + |
| 102 | +## FAQ |
| 103 | + |
| 104 | +- How do you enable gRPC? |
| 105 | + |
| 106 | + Set the backend protocol to *GRPC*. |
| 107 | + |
| 108 | +- How do you enable WebSocket? |
| 109 | + |
| 110 | + WebSocket is enabled by default if you set the backend protocol to *Default*. The WebSocket connection limit is 20000. When you reach that limit, the connection will fail. |
| 111 | + |
| 112 | + You can also use RSocket based on WebSocket. |
| 113 | + |
| 114 | +- What is the difference between ingress config and ingress settings? |
| 115 | + |
| 116 | + Ingress config can still be used in the Azure CLI and SDK, and that setting will apply to all apps within the service instance. Once an app has been configured by ingress settings, the Ingress config won't affect it. We don't recommend that new scripts use ingress config since we plan to stop supporting it in the future. |
| 117 | + |
| 118 | +- When ingress settings are used together with App Gateway/APIM, what happens when you set the timeout in both Azure Spring Apps ingress and the App Gateway/APIM? |
| 119 | + |
| 120 | + The shorter timeout is used. |
| 121 | + |
| 122 | +- Do you need extra config in App Gateway/APIM if you need to have end-to-end support for gRPC or WebSocket? |
| 123 | + |
| 124 | + You don't need extra config as long as the App Gateway supports gRPC. |
| 125 | + |
| 126 | +- Is configurable port supported? |
| 127 | + |
| 128 | + Configurable port isn't currently supported (80/443). |
73 | 129 |
|
74 | 130 | ## Next steps
|
75 | 131 |
|
76 |
| -- [Learn more about ingress controller](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers) |
77 |
| -- [Learn more about NGINX ingress controller](https://kubernetes.github.io/ingress-nginx) |
| 132 | +- [Ingress controllers](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers) |
| 133 | +- [NGINX ingress controller](https://kubernetes.github.io/ingress-nginx) |
0 commit comments