Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4496fb4

Browse files
committedOct 23, 2019
added exposing service over http/https under tutorials
1 parent 887acf4 commit 4496fb4

7 files changed

+201
-16
lines changed
 
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
---
2+
title: Exposing an AKS service over HTTP or HTTPS using Application Gateway
3+
description: This article provides information on how to expose an AKS service over HTTP or HTTPS using Application Gateway.
4+
services: application-gateway
5+
author: caya
6+
ms.service: application-gateway
7+
ms.topic: article
8+
ms.date: 10/22/2019
9+
ms.author: caya
10+
---
11+
12+
# Tutorials
13+
14+
These tutorials help illustrate the usage of [Kubernetes Ingress Resources](https://kubernetes.io/docs/concepts/services-networking/ingress/) to expose an example Kubernetes service through the [Azure Application Gateway](https://azure.microsoft.com/services/application-gateway/) over HTTP or HTTPS.
15+
16+
## Table of Contents
17+
18+
- [Prerequisites](#prerequisites)
19+
- [Deploy `guestbook` application](#deploy-guestbook-application)
20+
- [Expose services over HTTP](#expose-services-over-http)
21+
- [Expose services over HTTPS](#expose-services-over-https)
22+
- [Without specified hostname](#without-specified-hostname)
23+
- [With specified hostname](#with-specified-hostname)
24+
- [Integrate with other services](#integrate-with-other-services)
25+
26+
## Prerequisites
27+
28+
- Installed `ingress-azure` helm chart.
29+
- [**Greenfield Deployment**](application-gateway-ingress-controller-install-new.md): If you are starting from scratch, refer to these installation instructions which outlines steps to deploy an AKS cluster with Application Gateway and install application gateway ingress controller on the AKS cluster.
30+
- [**Brownfield Deployment**](application-gateway-ingress-controller-install-existing.md): If you have an existing AKS cluster and Application Gateway, refer to these instructions to install application gateway ingress controller on the AKS cluster.
31+
- If you want to use HTTPS on this application, you will need a x509 certificate and its private key.
32+
33+
## Deploy `guestbook` application
34+
35+
The guestbook application is a canonical Kubernetes application that composes of a Web UI frontend, a backend and a Redis database. By default, `guestbook` exposes its application through a service with name `frontend` on port `80`. Without a Kubernetes Ingress Resource the service is not accessible from outside the AKS cluster. We will use the application and setup Ingress Resources to access the application through HTTP and HTTPS.
36+
37+
Follow the instructions below to deploy the guestbook application.
38+
39+
1. Download `guestbook-all-in-one.yaml` from [here](https://raw.githubusercontent.com/kubernetes/examples/master/guestbook/all-in-one/guestbook-all-in-one.yaml)
40+
1. Deploy `guestbook-all-in-one.yaml` into your AKS cluster by running
41+
42+
```bash
43+
kubectl apply -f guestbook-all-in-one.yaml
44+
```
45+
46+
Now, the `guestbook` application has been deployed.
47+
48+
## Expose services over HTTP
49+
50+
In order to expose the guestbook application we will using the following ingress resource:
51+
52+
```yaml
53+
apiVersion: extensions/v1beta1
54+
kind: Ingress
55+
metadata:
56+
name: guestbook
57+
annotations:
58+
kubernetes.io/ingress.class: azure/application-gateway
59+
spec:
60+
rules:
61+
- http:
62+
paths:
63+
- backend:
64+
serviceName: frontend
65+
servicePort: 80
66+
```
67+
68+
This ingress will expose the `frontend` service of the `guestbook-all-in-one` deployment
69+
as a default backend of the Application Gateway.
70+
71+
Save the above ingress resource as `ing-guestbook.yaml`.
72+
73+
1. Deploy `ing-guestbook.yaml` by running:
74+
75+
```bash
76+
kubectl apply -f ing-guestbook.yaml
77+
```
78+
79+
1. Check the log of the ingress controller for deployment status.
80+
81+
Now the `guestbook` application should be available. You can check this by visiting the
82+
public address of the Application Gateway.
83+
84+
## Expose services over HTTPS
85+
86+
### Without specified hostname
87+
88+
Without specifying hostname, the guestbook service will be available on all the host-names pointing to the application gateway.
89+
90+
1. Before deploying ingress, you need to create a kubernetes secret to host the certificate and private key. You can create a kubernetes secret by running
91+
92+
```bash
93+
kubectl create secret tls <guestbook-secret-name> --key <path-to-key> --cert <path-to-cert>
94+
```
95+
96+
1. Define the following ingress. In the ingress, specify the name of the secret in the `secretName` section.
97+
98+
```yaml
99+
apiVersion: extensions/v1beta1
100+
kind: Ingress
101+
metadata:
102+
name: guestbook
103+
annotations:
104+
kubernetes.io/ingress.class: azure/application-gateway
105+
spec:
106+
tls:
107+
- secretName: <guestbook-secret-name>
108+
rules:
109+
- http:
110+
paths:
111+
- backend:
112+
serviceName: frontend
113+
servicePort: 80
114+
```
115+
116+
*NOTE:* Replace `<guestbook-secret-name>` in the above Ingress Resource with the name of your secret. Store the above Ingress Resource in a file name `ing-guestbook-tls.yaml`.
117+
118+
1. Deploy ing-guestbook-tls.yaml by running
119+
120+
```bash
121+
kubectl apply -f ing-guestbook-tls.yaml
122+
```
123+
124+
1. Check the log of the ingress controller for deployment status.
125+
126+
Now the `guestbook` application will be available on both HTTP and HTTPS.
127+
128+
### With specified hostname
129+
130+
You can also specify the hostname on the ingress in order to multiplex TLS configurations and services.
131+
By specifying hostname, the guestbook service will only be available on the specified host.
132+
133+
1. Define the following ingress.
134+
In the ingress, specify the name of the secret in the `secretName` section and replace the hostname in the `hosts` section accordingly.
135+
136+
```yaml
137+
apiVersion: extensions/v1beta1
138+
kind: Ingress
139+
metadata:
140+
name: guestbook
141+
annotations:
142+
kubernetes.io/ingress.class: azure/application-gateway
143+
spec:
144+
tls:
145+
- hosts:
146+
- <guestbook.contoso.com>
147+
secretName: <guestbook-secret-name>
148+
rules:
149+
- host: <guestbook.contoso.com>
150+
http:
151+
paths:
152+
- backend:
153+
serviceName: frontend
154+
servicePort: 80
155+
```
156+
157+
1. Deploy `ing-guestbook-tls-sni.yaml` by running
158+
159+
```bash
160+
kubectl apply -f ing-guestbook-tls-sni.yaml
161+
```
162+
163+
1. Check the log of the ingress controller for deployment status.
164+
165+
Now the `guestbook` application will be available on both HTTP and HTTPS only on the specified host (`<guestbook.contoso.com>` in this example).
166+
167+
## Integrate with other services
168+
169+
The following ingress will allow you to add additional paths into this ingress and redirect those paths to other services:
170+
171+
```yaml
172+
apiVersion: extensions/v1beta1
173+
kind: Ingress
174+
metadata:
175+
name: guestbook
176+
annotations:
177+
kubernetes.io/ingress.class: azure/application-gateway
178+
spec:
179+
rules:
180+
- http:
181+
paths:
182+
- path: </other/*>
183+
backend:
184+
serviceName: <other-service>
185+
servicePort: 80
186+
- backend:
187+
serviceName: frontend
188+
servicePort: 80
189+
```

‎articles/application-gateway/application-gateway-ingress-controller-install-existing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Creating an ingress controller with an existing Application Gateway
3-
description: This article provides an introduction to what Application Gateway Ingress Controller is.
3+
description: This article provides information on how to deploy an Application Gateway Ingress Controller with an existing Application Gateway.
44
services: application-gateway
55
author: caya
66
ms.service: application-gateway
@@ -185,7 +185,7 @@ In the first few steps we install Helm's Tiller on your Kubernetes cluster. Use
185185
186186
1. Check the log of the newly created pod to verify if it started properly
187187
188-
Refer to the [tutorials](../tutorial.md) to understand how you can expose an AKS service over HTTP or HTTPS, to the internet, using an Azure App Gateway.
188+
Refer to [this how-to guide](application-gateway-ingress-controller-expose-service-over-http-https.md) to understand how you can expose an AKS service over HTTP or HTTPS, to the internet, using an Azure App Gateway.
189189
190190
191191

‎articles/application-gateway/application-gateway-ingress-controller-install-new.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Creating an ingress controller with a new Application Gateway
3-
description: This article provides an introduction to what Application Gateway Ingress Controller is.
3+
description: This article provides information on how to deploy an Application Gateway Ingress Controller with a new Application Gateway.
44
services: application-gateway
55
author: caya
66
ms.service: application-gateway
@@ -22,7 +22,7 @@ We recommend the use of [Azure Cloud Shell](https://shell.azure.com/) for all co
2222

2323
Alternatively, launch Cloud Shell from Azure portal using the following icon:
2424

25-
![Portal launch](../portal-launch-icon.png)
25+
![Portal launch](./media/portal-launch-icon.png)
2626

2727
Your [Azure Cloud Shell](https://shell.azure.com/) already has all necessary tools. Should you
2828
choose to use another environment, please ensure the following command line tools are installed:
@@ -292,5 +292,5 @@ kubectl apply -f apsnetapp.yaml
292292
293293
294294
## Other Examples
295-
The **[tutorials](../tutorial.md)** document contains more examples on how toexpose an AKS
295+
This [how-to guide](application-gateway-ingress-controller-expose-service-over-http-https.md) contains more examples on how to expose an AKS
296296
service via HTTP or HTTPS, to the Internet with App Gateway.

‎articles/application-gateway/application-gateway-ingress-controller-overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ AGIC is configured via the Kubernetes [Ingress resource](http://kubernetes.io/do
2626

2727
## Next Steps
2828

29-
- [**Greenfield Deployment**](https://docs.microsoft.com/azure/application-gateway/application-gateway-ingress-controller-install-new): Instructions on installing AGIC, AKS and App Gateway on
29+
- [**Greenfield Deployment**](application-gateway-ingress-controller-install-new.md): Instructions on installing AGIC, AKS and App Gateway on
3030
blank-slate infrastructure.
31-
- [**Brownfield Deployment**](https://docs.microsoft.com/azure/application-gateway/application-gateway-ingress-controller-install-existing): Install AGIC on an existing AKS and Application Gateway.
31+
- [**Brownfield Deployment**](application-gateway-ingress-controller-install-existing.md): Install AGIC on an existing AKS and Application Gateway.
3232

‎articles/application-gateway/overview.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ Web applications are increasingly targets of malicious attacks that exploit comm
5050
For more information, see [Web application firewall (WAF) in Application Gateway](https://docs.microsoft.com/azure/application-gateway/waf-overview).
5151

5252
## Ingress Controller
53-
Application Gateway Ingress Controller (AGIC) allows you to use Application Gateway as the ingress for an [Azure Kubernetes Service (AKS)](https://azure.microsoft.com/en-us/services/kubernetes-service/) cluster.
53+
Application Gateway Ingress Controller (AGIC) allows you to use Application Gateway as the ingress for an [Azure Kubernetes Service (AKS)](https://azure.microsoft.com/services/kubernetes-service/) cluster.
5454

55-
The ingress controller runs as a pod within the AKS cluster and consumes [Kubernetes Ingress Resources](https://kubernetes.io/docs/concepts/services-networking/ingress/) and converts them to an Application Gateway configuration which allows the gateway to load-balance traffic to the Kuberenetes pods.
55+
The ingress controller runs as a pod within the AKS cluster and consumes [Kubernetes Ingress Resources](https://kubernetes.io/docs/concepts/services-networking/ingress/) and converts them to an Application Gateway configuration which allows the gateway to load-balance traffic to the Kuberenetes pods. The ingress controller only supports Application Gateway V2 SKU.
5656

57-
For more information, see [Application Gateway Ingress Controller (AGIC)](https://docs.microsoft.com/azure/application-gateway/application-gateway-ingress-controller-overview).
57+
For more information, see [Application Gateway Ingress Controller (AGIC)](application-gateway-ingress-controller-overview.md).
5858

5959
## URL-based routing
6060

@@ -101,12 +101,6 @@ The WebSocket and HTTP/2 protocols enable full duplex communication between a se
101101

102102
For more information, see [WebSocket support](https://docs.microsoft.com/azure/application-gateway/application-gateway-websocket) and [HTTP/2 support](https://docs.microsoft.com/azure/application-gateway/configuration-overview#http2-support).
103103

104-
## Azure Kubernetes Service (AKS) Ingress controller preview
105-
106-
The Application Gateway Ingress controller runs as a pod within the AKS cluster and allows Application Gateway to act as ingress for an AKS cluster. This is supported with Application Gateway v2 only.
107-
108-
For more information, see [Azure Application Gateway Ingress Controller](https://azure.github.io/application-gateway-kubernetes-ingress/).
109-
110104
## Connection draining
111105

112106
Connection draining helps you achieve graceful removal of backend pool members during planned service updates. This setting is enabled via the backend http setting and can be applied to all members of a backend pool during rule creation. Once enabled, Application Gateway ensures all de-registering instances of a backend pool do not receive any new request while allowing existing requests to complete within a configured time limit. This applies to both backend instances that are explicitly removed from the backend pool by an API call, and backend instances that are reported as unhealthy as determined by the health probes.

‎articles/application-gateway/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@
163163
href: create-custom-waf-rules.md
164164
- name: Configure WAF with custom rules
165165
href: configure-waf-custom-rules.md
166+
- name: Deploy ingress controller over HTTP/HTTPS
167+
href: application-gateway-ingress-controller-expose-service-over-http-https.md
166168
- name: Route by URL
167169
items:
168170
- name: Azure PowerShell

0 commit comments

Comments
 (0)
Please sign in to comment.