Skip to content

Commit 13be876

Browse files
authored
GeoIP updates (#79)
* lab12 initial docs * lab12 rough draft * lab12 final draft * typos * fix nodeport * appworld updates * geoip updates
1 parent 7f752ff commit 13be876

File tree

9 files changed

+110
-12
lines changed

9 files changed

+110
-12
lines changed

labs/lab11/as.geo.example.com.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ server {
1111

1212
location / {
1313

14-
return 200 "Welcome to N4A Workshop, website $host\n";
14+
return 200 "Welcome to N4A Workshop, Asia website at $host\n";
1515
add_header X-DCTEST-FQDN $host;
1616

1717
}

labs/lab11/eu.geo.example.com.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ server {
1111

1212
location / {
1313

14-
return 200 "Welcome to N4A Workshop, website $host\n";
14+
return 200 "Welcome to N4A Workshop, Europe website at $host\n";
1515
add_header X-DCTEST-FQDN $host;
1616

1717
}
2.28 MB
Loading

labs/lab11/na.geo.example.com.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Nginx 4 Azure - na.example.com.conf
1+
# Nginx 4 Azure - na.geo.example.com.conf
22
# Chris Akker, Shouvik Dutta, Adam Currier - Jan 2025
33
#
44
# Nginx Server Block for GeoIP Continent Routing
@@ -11,7 +11,7 @@ server {
1111

1212
location / {
1313

14-
return 200 "Welcome to N4A Workshop, website $host\n";
14+
return 200 "Welcome to N4A Workshop, North America website at $host\n";
1515
add_header X-DCTEST-FQDN $host;
1616

1717
}

labs/lab11/readme.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ In your NGINX for Azure instance, the main NGINX `/etc/nginx/nginx.conf` file mu
9898
9999
```
100100
101-
Submit you NGINX Configuration, NGINX for Azure will validate it for you. You must fix any errors before proceeding.
101+
Submit your NGINX Configuration, NGINX for Azure will validate it for you. You must fix any errors before proceeding.
102102
103103
<br/>
104104
@@ -213,7 +213,9 @@ NGINXaaS for Azure | Global Data Centers | GeoIP2
213213
214214
<br/>
215215
216-
As you are likely a DevOps Engineer, Application Architect/Developer, or NGINX Admin with Global responsibilities, you have `multiple Data Centers spread around the world or the country`. As you also have users also around the world, you are probably using traditional `Global Server Load Balancing` and "SmartDNS" systems, to respond to DNS queries for your FQDNs. However, these systems are not usually in your control, and there is likely an entirely different team responsible for DNS administration/management, right? OH groan, more tickets and waiting... **What if there was an easier way, to find a user's location, and route the users to the closest data center?**
216+
As you are likely a DevOps Engineer, Application Architect/Developer, or NGINX Admin with Global responsibilities, you have `multiple Data Centers spread around the world or the country`. As you also have users also around the world, you are probably using traditional `Global Server Load Balancing` and "SmartDNS" systems, to respond to DNS queries for your FQDNs. However, these systems are not usually in your control, and there is likely an entirely different team responsible for DNS administration/management, right? OH groan, more tickets and waiting...
217+
218+
>**What if there was an easier way, to find a user's location, and route the users to the closest data center?**
217219
218220
You can easily do that with NGINX and the MaxMind GeoIP2 module, without requiring many changes from your DNS admin team.
219221
@@ -233,15 +235,19 @@ Reduce the cost of GSLB systems |
233235
234236
<br/>
235237
236-
But this Solution does eliminate or minimize many of the current challenges that exist with GSLB/DNS systems. The two most common NGINX-DevOps headaches are:
238+
But this Solution *does* eliminate or minimize many of the current challenges that exist with GSLB/DNS systems. The two most common NGINX-DevOps headaches are:
237239
238240
- Lack of DNS Admin access/control
239241
- *DNS caching of A records at multple points in the DNS system that you can't see or control, such as*:
240242
- Clients'/Browsers' local DNS Resolver cache
241243
- Internet/Cloud provider's DNS servers' cache
242244
- Your Company's DNS SOA/Nameservers in the Data Centers
243245
244-
In this exercise, you will route traffic to three Data Centers spread around the world, without using DNS. One Data Center in North America, one in Europe, and one in Asia. You will use the NGINX `$geoip2_data_continent_code variable` to redirect users to the Data Center in those three regions. You will use the NGINX `map directive` to associate the MaxMind Continent Code to a 2-character identifier, as a DNS sub-domain, as shown here:
246+
In this exercise, you will route traffic to three Data Centers spread around the world, without using DNS. One Data Center in North America, one in Europe, and one in Asia.
247+
248+
![N4A](media/lab11_3datacenters.png)
249+
250+
You will use the NGINX `$geoip2_data_continent_code variable` to redirect users to the Data Center in those three regions. You will use the NGINX `map directive` to associate the MaxMind Continent Code to a 2-character identifier, as a DNS sub-domain, as shown here:
245251
246252
```nginx
247253
map $geoip2_data_continent_code $nearest_data_center {
@@ -304,7 +310,7 @@ map $geoip2_data_continent_code $nearest_data_center {
304310
Here are the three new files, just copy/paste:
305311
306312
```nginx
307-
# NGINX 4 Azure - na.example.com.conf
313+
# NGINX 4 Azure - na.geo.example.com.conf
308314
# Chris Akker, Shouvik Dutta, Adam Currier - Jan 2025
309315
# NGINX Server Block for GeoIP Continent Routing
310316
#

labs/lab12/nodeport-static.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: nginx-ingress
5+
namespace: nginx-ingress
6+
spec:
7+
type: NodePort
8+
ports:
9+
- port: 80
10+
nodePort: 32080
11+
protocol: TCP
12+
name: http
13+
- port: 443
14+
nodePort: 32443
15+
protocol: TCP
16+
name: https
17+
- port: 9000
18+
nodePort: 32090
19+
protocol: TCP
20+
name: dashboard
21+
selector:
22+
app: nginx-ingress
23+

labs/lab12/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,4 +581,4 @@ You can also see that the NLK Controller will track your Cluster Node Scaling ch
581581

582582
-------------
583583

584-
Navigate to [LabGuide](../readme.md)
584+
Navigate to [LabGuide](../readme.md)

labs/lab4/cafe.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spec:
1414
spec:
1515
containers:
1616
- name: coffee
17-
image: nginxinc/ingress-demo
17+
image: chrisakker/ingress-demo
1818
ports:
1919
- containerPort: 80
2020
---
@@ -49,7 +49,7 @@ spec:
4949
spec:
5050
containers:
5151
- name: tea
52-
image: nginxinc/ingress-demo
52+
image: chrisakker/ingress-demo
5353
ports:
5454
- containerPort: 80
5555
---

labs/lab4/cafe.yaml.orig

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: coffee
5+
spec:
6+
replicas: 3
7+
selector:
8+
matchLabels:
9+
app: coffee
10+
template:
11+
metadata:
12+
labels:
13+
app: coffee
14+
spec:
15+
containers:
16+
- name: coffee
17+
image: nginxinc/ingress-demo
18+
ports:
19+
- containerPort: 80
20+
---
21+
apiVersion: v1
22+
kind: Service
23+
metadata:
24+
name: coffee-svc
25+
spec:
26+
type: ClusterIP
27+
clusterIP: None
28+
ports:
29+
- port: 80
30+
targetPort: 80
31+
protocol: TCP
32+
name: http
33+
selector:
34+
app: coffee
35+
---
36+
apiVersion: apps/v1
37+
kind: Deployment
38+
metadata:
39+
name: tea
40+
spec:
41+
replicas: 3
42+
selector:
43+
matchLabels:
44+
app: tea
45+
template:
46+
metadata:
47+
labels:
48+
app: tea
49+
spec:
50+
containers:
51+
- name: tea
52+
image: nginxinc/ingress-demo
53+
ports:
54+
- containerPort: 80
55+
---
56+
apiVersion: v1
57+
kind: Service
58+
metadata:
59+
name: tea-svc
60+
spec:
61+
type: ClusterIP
62+
clusterIP: None
63+
ports:
64+
- port: 80
65+
targetPort: 80
66+
protocol: TCP
67+
name: http
68+
selector:
69+
app: tea

0 commit comments

Comments
 (0)