Skip to content

Commit 232a646

Browse files
Merge pull request #216060 from MGoedtel/task1959640
Revised article to align with deprecation of K8s extensions/v1beta1
2 parents ab8bed1 + 57e0bd1 commit 232a646

File tree

1 file changed

+76
-53
lines changed

1 file changed

+76
-53
lines changed

articles/application-gateway/ingress-controller-annotations.md

Lines changed: 76 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,33 @@ services: application-gateway
55
author: greg-lindsay
66
ms.service: application-gateway
77
ms.topic: article
8-
ms.date: 3/18/2022
8+
ms.date: 10/26/2022
99
ms.author: greglin
1010
---
1111

12-
# Annotations for Application Gateway Ingress Controller
12+
# Annotations for Application Gateway Ingress Controller
1313

14-
## Introductions
15-
16-
The Kubernetes Ingress resource can be annotated with arbitrary key/value pairs. AGIC relies on annotations to program Application Gateway features, which are not configurable via the Ingress YAML. Ingress annotations are applied to all HTTP setting, backend pools, and listeners derived from an ingress resource.
14+
The Kubernetes Ingress resource can be annotated with arbitrary key/value pairs. AGIC relies on annotations to program Application Gateway features, which aren't configurable using the Ingress YAML. Ingress annotations are applied to all HTTP settings, backend pools, and listeners derived from an ingress resource.
1715

1816
## List of supported annotations
1917

20-
For an Ingress resource to be observed by AGIC, it **must be annotated** with `kubernetes.io/ingress.class: azure/application-gateway`. Only then AGIC will work with the Ingress resource in question.
18+
For an Ingress resource to be observed by AGIC, it **must be annotated** with `kubernetes.io/ingress.class: azure/application-gateway`. Only then AGIC works with the Ingress resource in question.
2119

22-
| Annotation Key | Value Type | Default Value | Allowed Values
20+
| Annotation Key | Value Type | Default Value | Allowed Values |
2321
| -- | -- | -- | -- |
24-
| [appgw.ingress.kubernetes.io/backend-path-prefix](#backend-path-prefix) | `string` | `nil` | |
22+
| [appgw.ingress.kubernetes.io/backend-path-prefix](#backend-path-prefix) | `string` | `nil` ||
2523
| [appgw.ingress.kubernetes.io/ssl-redirect](#tls-redirect) | `bool` | `false` | |
26-
| [appgw.ingress.kubernetes.io/connection-draining](#connection-draining) | `bool` | `false` | |
27-
| [appgw.ingress.kubernetes.io/connection-draining-timeout](#connection-draining) | `int32` (seconds) | `30` | |
28-
| [appgw.ingress.kubernetes.io/cookie-based-affinity](#cookie-based-affinity) | `bool` | `false` | |
29-
| [appgw.ingress.kubernetes.io/request-timeout](#request-timeout) | `int32` (seconds) | `30` | |
30-
| [appgw.ingress.kubernetes.io/use-private-ip](#use-private-ip) | `bool` | `false` | |
24+
| [appgw.ingress.kubernetes.io/connection-draining](#connection-draining) | `bool` | `false` ||
25+
| [appgw.ingress.kubernetes.io/connection-draining-timeout](#connection-draining) | `int32` (seconds) | `30` ||
26+
| [appgw.ingress.kubernetes.io/cookie-based-affinity](#cookie-based-affinity) | `bool` | `false` ||
27+
| [appgw.ingress.kubernetes.io/request-timeout](#request-timeout) | `int32` (seconds) | `30` ||
28+
| [appgw.ingress.kubernetes.io/use-private-ip](#use-private-ip) | `bool` | `false` ||
3129
| [appgw.ingress.kubernetes.io/backend-protocol](#backend-protocol) | `string` | `http` | `http`, `https` |
32-
| [appgw.ingress.kubernetes.io/rewrite-rule-set](#rewrite-rule-set) | `string` | `nil` | |
30+
| [appgw.ingress.kubernetes.io/rewrite-rule-set](#rewrite-rule-set) | `string` | `nil` ||
3331

3432
## Backend Path Prefix
3533

36-
This annotation allows the backend path specified in an ingress resource to be rewritten with prefix specified in this annotation. This allows users to expose services whose endpoints are different than endpoint names used to expose a service in an ingress resource.
34+
The following annotation allows the backend path specified in an ingress resource to be rewritten with prefix specified in this annotation. It allows users to expose services whose endpoints are different than endpoint names used to expose a service in an ingress resource.
3735

3836
### Usage
3937

@@ -44,7 +42,7 @@ appgw.ingress.kubernetes.io/backend-path-prefix: <path prefix>
4442
### Example
4543
4644
```yaml
47-
apiVersion: extensions/v1beta1
45+
apiVersion: apiVersion: networking.k8s.io/v1
4846
kind: Ingress
4947
metadata:
5048
name: go-server-ingress-bkprefix
@@ -57,22 +55,26 @@ spec:
5755
- http:
5856
paths:
5957
- path: /hello/
58+
pathType: Exact
6059
backend:
61-
serviceName: go-server-service
62-
servicePort: 80
60+
service:
61+
name: go-server-service
62+
port:
63+
number: 80
6364
```
64-
In the example above, we have defined an ingress resource named `go-server-ingress-bkprefix` with an annotation `appgw.ingress.kubernetes.io/backend-path-prefix: "/test/"` . The annotation tells application gateway to create an HTTP setting, which will have a path prefix override for the path `/hello` to `/test/`.
6565
66-
> [!NOTE]
67-
> In the above example we have only one rule defined. However, the annotations are applicable to the entire ingress resource, so if a user had defined multiple rules, the backend path prefix would be set up for each of the paths specified. Thus, if a user wants different rules with different path prefixes (even for the same service) they would need to define different ingress resources.
66+
In the previous example, you've defined an ingress resource named `go-server-ingress-bkprefix` with an annotation `appgw.ingress.kubernetes.io/backend-path-prefix: "/test/"`. The annotation tells application gateway to create an HTTP setting, which has a path prefix override for the path `/hello` to `/test/`.
67+
68+
> [!NOTE]
69+
> In the above example, only one rule is defined. However, the annotations are applicable to the entire ingress resource, so if a user defined multiple rules, the backend path prefix would be set up for each of the paths specified. If a user wants different rules with different path prefixes (even for the same service), they would need to define different ingress resources.
6870

6971
## TLS Redirect
7072

7173
Application Gateway [can be configured](./redirect-overview.md)
7274
to automatically redirect HTTP URLs to their HTTPS counterparts. When this
7375
annotation is present and TLS is properly configured, Kubernetes Ingress
74-
controller will create a [routing rule with a redirection configuration](./redirect-http-to-https-portal.md#add-a-routing-rule-with-a-redirection-configuration)
75-
and apply the changes to your Application Gateway. The redirect created will be HTTP `301 Moved Permanently`.
76+
controller creates a [routing rule with a redirection configuration](./redirect-http-to-https-portal.md#add-a-routing-rule-with-a-redirection-configuration)
77+
and applies the changes to your Application Gateway. The redirect created will be HTTP `301 Moved Permanently`.
7678

7779
### Usage
7880

@@ -83,7 +85,7 @@ appgw.ingress.kubernetes.io/ssl-redirect: "true"
8385
### Example
8486

8587
```yaml
86-
apiVersion: extensions/v1beta1
88+
apiVersion: apiVersion: networking.k8s.io/v1
8789
kind: Ingress
8890
metadata:
8991
name: go-server-ingress-redirect
@@ -101,14 +103,16 @@ spec:
101103
http:
102104
paths:
103105
- backend:
104-
serviceName: websocket-repeater
105-
servicePort: 80
106+
service:
107+
name: websocket-repeater
108+
port:
109+
number: 80
106110
```
107111

108112
## Connection Draining
109113

110-
`connection-draining`: This annotation allows users to specify whether to enable connection draining.
111-
`connection-draining-timeout`: This annotation allows users to specify a timeout after which Application Gateway will terminate the requests to the draining backend endpoint.
114+
`connection-draining`: This annotation allows us to specify whether to enable connection draining.
115+
`connection-draining-timeout`: This annotation allows us to specify a timeout, after which Application Gateway terminates the requests to the draining backend endpoint.
112116

113117
### Usage
114118

@@ -120,7 +124,7 @@ appgw.ingress.kubernetes.io/connection-draining-timeout: "60"
120124
### Example
121125

122126
```yaml
123-
apiVersion: extensions/v1beta1
127+
apiVersion: apiVersion: networking.k8s.io/v1
124128
kind: Ingress
125129
metadata:
126130
name: go-server-ingress-drain
@@ -134,14 +138,17 @@ spec:
134138
- http:
135139
paths:
136140
- path: /hello/
141+
pathType: Exact
137142
backend:
138-
serviceName: go-server-service
139-
servicePort: 80
143+
service:
144+
name: go-server-service
145+
port:
146+
number: 80
140147
```
141148

142149
## Cookie Based Affinity
143150

144-
This annotation allows to specify whether to enable cookie based affinity.
151+
The following annotation allows you to specify whether to enable cookie based affinity.
145152

146153
### Usage
147154

@@ -152,7 +159,7 @@ appgw.ingress.kubernetes.io/cookie-based-affinity: "true"
152159
### Example
153160

154161
```yaml
155-
apiVersion: extensions/v1beta1
162+
apiVersion: apiVersion: networking.k8s.io/v1
156163
kind: Ingress
157164
metadata:
158165
name: go-server-ingress-affinity
@@ -165,14 +172,17 @@ spec:
165172
- http:
166173
paths:
167174
- path: /hello/
175+
pathType: Exact
168176
backend:
169-
serviceName: go-server-service
170-
servicePort: 80
177+
service:
178+
name: go-server-service
179+
port:
180+
number: 80
171181
```
172182

173183
## Request Timeout
174184

175-
This annotation allows to specify the request timeout in seconds after which Application Gateway will fail the request if response is not received.
185+
The following annotation allows you to specify the request timeout in seconds, after which Application Gateway fails the request if response is not received.
176186

177187
### Usage
178188

@@ -183,7 +193,7 @@ appgw.ingress.kubernetes.io/request-timeout: "20"
183193
### Example
184194

185195
```yaml
186-
apiVersion: extensions/v1beta1
196+
apiVersion: apiVersion: networking.k8s.io/v1
187197
kind: Ingress
188198
metadata:
189199
name: go-server-ingress-timeout
@@ -196,28 +206,32 @@ spec:
196206
- http:
197207
paths:
198208
- path: /hello/
209+
pathType: Exact
199210
backend:
200-
serviceName: go-server-service
201-
servicePort: 80
211+
service:
212+
name: go-server-service
213+
port:
214+
number: 80
202215
```
203216

204217
## Use Private IP
205218

206-
This annotation allows us to specify whether to expose this endpoint on Private IP of Application Gateway.
219+
The following annotation allows you to specify whether to expose this endpoint on Private IP of Application Gateway.
207220

208221
> [!NOTE]
209-
> * Application Gateway doesn't support multiple IPs on the same port (example: 80/443). Ingress with annotation `appgw.ingress.kubernetes.io/use-private-ip: "false"` and another with `appgw.ingress.kubernetes.io/use-private-ip: "true"` on `HTTP` will cause AGIC to fail in updating the Application Gateway.
210-
> * For Application Gateway that doesn't have a private IP, Ingresses with `appgw.ingress.kubernetes.io/use-private-ip: "true"` will be ignored. This will reflected in the controller logs and ingress events for those ingresses with `NoPrivateIP` warning.
211-
222+
> * Application Gateway doesn't support multiple IPs on the same port (example: 80/443). Ingress with annotation `appgw.ingress.kubernetes.io/use-private-ip: "false"` and another with `appgw.ingress.kubernetes.io/use-private-ip: "true"` on `HTTP` will cause AGIC to fail while updating the Application Gateway.
223+
> * For Application Gateway that doesn't have a private IP, Ingresses with `appgw.ingress.kubernetes.io/use-private-ip: "true"` is ignored. This is reflected in the controller logs and ingress events for those ingresses with `NoPrivateIP` warning.
212224

213225
### Usage
226+
214227
```yaml
215228
appgw.ingress.kubernetes.io/use-private-ip: "true"
216229
```
217230

218231
### Example
232+
219233
```yaml
220-
apiVersion: extensions/v1beta1
234+
apiVersion: apiVersion: networking.k8s.io/v1
221235
kind: Ingress
222236
metadata:
223237
name: go-server-ingress-timeout
@@ -230,27 +244,33 @@ spec:
230244
- http:
231245
paths:
232246
- path: /hello/
247+
pathType: Exact
233248
backend:
234-
serviceName: go-server-service
235-
servicePort: 80
249+
service:
250+
name: go-server-service
251+
port:
252+
number: 80
236253
```
237254

238255
## Backend Protocol
239256

240-
This annotation allows us to specify the protocol that Application Gateway should use while talking to the Pods. Supported Protocols: `http`, `https`
257+
The following annotation allows you to specify the protocol that Application Gateway should use while communicating with the pods. Supported Protocols are `http` and `https`.
241258

242259
> [!NOTE]
243-
> * While self-signed certificates are supported on Application Gateway, currently, AGIC only support `https` when Pods are using certificate signed by a well-known CA.
244-
> * Make sure to not use port 80 with HTTPS and port 443 with HTTP on the Pods.
260+
> While self-signed certificates are supported on Application Gateway, currently AGIC only supports `https` when pods are using a certificate signed by a well-known CA.
261+
>
262+
> Don't use port 80 with HTTPS and port 443 with HTTP on the pods.
245263

246264
### Usage
265+
247266
```yaml
248267
appgw.ingress.kubernetes.io/backend-protocol: "https"
249268
```
250269

251270
### Example
271+
252272
```yaml
253-
apiVersion: extensions/v1beta1
273+
apiVersion: apiVersion: networking.k8s.io/v1
254274
kind: Ingress
255275
metadata:
256276
name: go-server-ingress-timeout
@@ -263,14 +283,17 @@ spec:
263283
- http:
264284
paths:
265285
- path: /hello/
286+
pathType: Exact
266287
backend:
267-
serviceName: go-server-service
268-
servicePort: 443
288+
service:
289+
name: go-server-service
290+
port:
291+
number: 443
269292
```
270293

271294
## Rewrite Rule Set
272295

273-
This annotation allows you to assign an existing rewrite rule set to the corresponding request routing rule.
296+
The following annotation allows you to assign an existing rewrite rule set to the corresponding request routing rule.
274297

275298
### Usage
276299

0 commit comments

Comments
 (0)