Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit b523795

Browse files
committed
update install guides
1 parent 8f127dc commit b523795

16 files changed

+313
-241
lines changed

docs/http/http-installation-guide.md

Lines changed: 63 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This Solution provides a replacement, using an NGINX Server, and a new K8s Contr
2929

3030
<br/>
3131

32-
![NKL Solution Overview](../media/nkl-multicluster-diagram.png)
32+
![NKL MC Solution Overview](../media/nkl-multicluster-diagram.png)
3333

3434
<br/>
3535

@@ -38,7 +38,7 @@ This Solution provides a replacement, using an NGINX Server, and a new K8s Contr
3838
1. Install NGINX Ingress Controller in your Cluster
3939
2. Install NGINX Cafe Demo Application in your Cluster
4040
3. Install NGINX Plus on the Loadbalancer Server(s)
41-
4. Configure NGINX Plus for MultiCluster Load Balancing
41+
4. Configure NGINX Plus for HTTP MultiCluster Load Balancing
4242
5. Install NKL NGINX Kubernetes LB Controller in your Cluster
4343
6. Install NKL LoadBalancer or NodePort Service manifest
4444
7. Test out NKL
@@ -54,7 +54,7 @@ This Solution provides a replacement, using an NGINX Server, and a new K8s Contr
5454
- Demo application, this install guide uses the NGINX Cafe example, found here: https://github.com/nginxinc/kubernetes-ingress/tree/main/examples/ingress-resources/complete-example
5555
- A bare metal Linux server or VM for the external NGINX LB Server, connected to a network external to the cluster. Two of these will be required if High Availability is needed, as shown here.
5656
- NGINX Plus software loaded on the LB Server(s). This install guide follows the instructions for installing NGINX Plus on Centos 7, located here: https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-plus/
57-
- The NGINX Kubernetes Loadbalancer (NKL) Controller, new software from Nginx for this Solution.
57+
- The NGINX Kubernetes Loadbalancer (NKL) Controller, new software from NGINX for this Solution.
5858

5959
<br/>
6060

@@ -78,16 +78,19 @@ A standard K8s cluster is all that is required, two or more Clusters if you want
7878

7979
<br/>
8080

81-
The NGINX Ingress Controller in this Solution is the destination target for traffic (north-south) that is being sent to the cluster(s). The installation of the actual Ingress Controller is outside the scope of this guide, but the links to the docs are included for your reference. `The NIC installation using Manifests must follow the documents exactly as written,` as this Solution depends on the `nginx-ingress` namespace and service objects. **Only the very last step is changed.**
81+
The NGINX Ingress Controller in this Solution is the destination target for traffic (north-south) that is being sent to the cluster(s). The installation of the actual Ingress Controller is outside the scope of this guide, but the links to the docs are included for your reference. The NIC installation using Manifests must follow the documents exactly as written, as this Solution depends on the `nginx-ingress` namespace and service objects. **Only the very last step is changed.**
8282

83-
**NOTE:** This Solution only works with `nginx-ingress from NGINX`. It will not work with the K8s Community version of Ingress, called ingress-nginx.
83+
**NOTE:** This Solution only works with `nginx-ingress` from NGINX. It will not work with the K8s Community version of Ingress, called ingress-nginx.
8484

8585
If you are unsure which Ingress Controller you are running, check out the blog on nginx.com:
8686

8787
https://www.nginx.com/blog/guide-to-choosing-ingress-controller-part-4-nginx-ingress-controller-options
8888

89+
<br/>
90+
91+
>>Important! Do not complete the very last step in the NIC deployment with Manifests, `do not deploy the loadbalancer.yaml or nodeport.yaml Service file!` You will apply a different loadbalancer or nodeport Service manifest later, after the NKL Controller is up and running. `The nginx-ingress Service file must be changed` - it is not the default file.
8992
90-
>Important! Do not complete the very last step in the NIC deployment with Manifests, `do not deploy the loadbalancer.yaml or nodeport.yaml Service file!` You will apply a different loadbalancer or nodeport Service manifest later, after the NKL Controller is up and running. `The Service file must be changed` - it is not the default file.
93+
<br/>
9194

9295
## 2. Install NGINX Cafe Demo Application
9396

@@ -97,10 +100,12 @@ https://www.nginx.com/blog/guide-to-choosing-ingress-controller-part-4-nginx-ing
97100

98101
<br/>
99102

100-
This is not part of the actual Solution, but it is useful to have a well-known application running in the cluster, as a known-good target for test commands. The example provided here is used by the Solution to demonstrate proper traffic flows.
103+
This is not a component of the actual Solution, but it is useful to have a well-known application running in the cluster, as a known-good target for test commands. The example provided here is used by the Solution to demonstrate proper traffic flows.
101104

102105
Note: If you choose a different Application to test with, `the NGINX configurations and health checks provided here may not work,` and will need to be modified to work correctly.
103106

107+
<br/>
108+
104109
- Use the provided Cafe Demo manifests in the docs/cafe-demo folder:
105110

106111
```bash
@@ -117,7 +122,7 @@ Note: If you choose a different Application to test with, `the NGINX configurati
117122

118123
https://hub.docker.com/r/nginxinc/ingress-demo
119124

120-
**IMPORTANT** - Do not use the `cafe-ingress.yaml` file. Rather, use the `cafe-virtualserver.yaml` file that is provided here. It uses the NGINX Plus CRDs to define a VirtualServer, and the related Virtual Server Routes needed. If you are using NGINX OSS Ingress Controller, you will need to use the appropriate manifests, which is not covered in this Solution.
125+
**IMPORTANT** - Do not use the `cafe-ingress.yaml` file. Rather, use the `cafe-virtualserver.yaml` file that is provided here. It uses the NGINX Plus CRDs to define a VirtualServer, and the related VirtualServer Routes needed. If you are using NGINX OSS Ingress Controller, you will need to use the appropriate manifests, which is not covered in this Solution.
121126

122127
<br/>
123128

@@ -138,7 +143,7 @@ This Solution followed the `Installation of NGINX Plus on Centos/Redhat/Oracle`
138143

139144
https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-plus/
140145

141-
>NOTE: This solution will only work with NGINX Plus, as NGINX OpenSource does not have the API that is used in this Solution. Installation on unsupported Linux Distros is not recommended.
146+
>NOTE: This Solution will only work with NGINX Plus, as NGINX OpenSource does not have the API that is used in this Solution. Installation on unsupported Linux Distros is not recommended.
142147
143148
If you need a license for NGINX Plus, a 30-day Trial license is available here:
144149

@@ -193,7 +198,7 @@ After a new installation of NGINX Plus, make the following configuration changes
193198
```bash
194199
cat /etc/nginx/conf.d/default.conf
195200
# NGINX K8s Loadbalancer Solution
196-
# Chris Akker, Jan 2023
201+
# Chris Akker, Apr 2023
197202
# Example default.conf
198203
# Change default_server to port 8080
199204
#
@@ -245,15 +250,14 @@ worker_processes auto;
245250
error_log /var/log/nginx/error.log notice;
246251
pid /var/run/nginx.pid;
247252

248-
load_module modules/ngx_http_js_module.so; # Load NJS module
253+
load_module modules/ngx_http_js_module.so; # Added for Prometheus
249254

250255
worker_rlimit_nofile 2048;
251256

252257
events {
253258
worker_connections 2048;
254259
}
255260

256-
257261
http {
258262
include /etc/nginx/mime.types;
259263
default_type application/octet-stream;
@@ -273,22 +277,24 @@ http {
273277

274278
include /etc/nginx/conf.d/*.conf;
275279

276-
#added for Prometheus
277-
subrequest_output_buffer_size 32k;
280+
subrequest_output_buffer_size 32k; #added for Prometheus
278281

279282
}
280283

281-
# TCP load balancing block
284+
# TCP/UDP proxy and load balancing block
282285
#
283286
stream {
284-
include /etc/nginx/stream/*.conf;
285-
log_format stream '$remote_addr - $server_addr [$time_local] $status $upstream_addr $upstream_bytes_sent';
286-
access_log /var/log/nginx/stream.log stream;
287+
288+
include /etc/nginx/stream/*.conf;
289+
290+
log_format stream '$remote_addr - $server_addr [$time_local] $status $upstream_addr $upstream_bytes_sent';
291+
292+
access_log /var/log/nginx/stream.log stream;
287293
}
288294

289295
```
290296

291-
- Configure NGINX for HTTP traffic processing, load balancing, and MultiCluster Split Clients for this Solution.
297+
- Configure NGINX for HTTP/S traffic processing, MultiCluster load balancing with HTTP Split Clients for this Solution.
292298

293299
`Notice that this example Solution only uses port 443 and terminates TLS.`
294300

@@ -380,7 +386,7 @@ upstream cluster2-https {
380386
state /var/lib/nginx/state/cluster2-https.state;
381387
}
382388

383-
# HTTP Split Clients Configuration for Cluster1/Cluster2 ratios
389+
# HTTP Split Clients Configuration for Cluster1:Cluster2 ratios
384390
# Ratios provided: 0,1,5,10,25,50,75,90,95,99,100%
385391

386392
split_clients $request_id $split0 {
@@ -479,15 +485,15 @@ server {
479485

480486
```
481487

482-
- High Availability: If you have 2 or more NGINX Plus LB Servers, you can use Zone Sync to synchronize the KeyValue SplitRatio data between the NGINX Servers automatically. Use the `zonesync.conf` example file provided, change the IP addresses to match your NGINX LB Servers. Place this file in /etc/nginx/stream folder on each LB Server, and reload NGINX. Note: This example does not provide any security for the Zone Sync traffic, secure as necessary with TLS or IP allowlist.
488+
- High Availability: If you have 2 or more NGINX Plus LB Servers, you can use Zone Sync to synchronize the KeyValue SplitRatio data between the NGINX LB Servers automatically. Use the `zonesync.conf` example file provided, change the IP addresses to match your NGINX LB Servers. Place this file in /etc/nginx/stream folder on each LB Server, and reload NGINX. Note: This example does not provide any security for the Zone Sync traffic, secure as necessary with TLS or IP allowlist.
483489

484490
```bash
485491
cat zonesync.conf
486492

487493
# NGINX K8sLB Zone Sync configuration, for KeyVal split
488494
# Chris Akker, Apr 2023
489495
# Stream Zone Sync block
490-
# 2 NGINX Plus nodes KeyVal zone
496+
# 2 NGINX Plus nodes
491497
# NGINX Kubernetes Loadbalancer
492498
# https://docs.nginx.com/nginx/admin-guide/high-availability/zone_sync/
493499
#
@@ -506,7 +512,7 @@ server {
506512

507513
```
508514

509-
Watching the NGINX Plus Dashboard, Cluster Tab, you will see messages sent/received if Zone Sync is operating correctly:
515+
- Checking the NGINX Plus Dashboard, Cluster Tab, you will see the Status of the `split` Zone as Green, and messages sent/received if Zone Sync is operating correctly:
510516

511517
![Zone Sync](../media/nkl-zone-sync.png)
512518

@@ -522,23 +528,25 @@ Watching the NGINX Plus Dashboard, Cluster Tab, you will see messages sent/recei
522528

523529
### This is the new K8s Controller from NGINX, which is configured to watch the k8s environment, the `nginx-ingress` Service object, and send API updates to the NGINX LB Server(s) when there are changes. It only requires three things:
524530

525-
- New kubernetes namespace and RBAC
526-
- NKL ConfigMap, to configure the Controller
527-
- NKL Deployment, to deploy and run the Controller
531+
1. New Kubernetes namespace and RBAC
532+
2. NKL ConfigMap, to configure the Controller
533+
3. NKL Deployment, to deploy and run the Controller
528534

529-
Create the new `nkl` K8s namespace:
535+
<br/>
536+
537+
- Create the new `nkl` K8s namespace:
530538

531539
```bash
532540
kubectl create namespace nkl
533541
```
534542

535-
Apply the manifests for NKL's Secret, Service, ClusterRole, and ClusterRoleBinding:
543+
- Apply the manifests for NKL's Secret, Service, ClusterRole, and ClusterRoleBinding:
536544

537545
```bash
538546
kubectl apply -f secret.yaml serviceaccount.yaml clusterrole.yaml clusterrolebinding.yaml
539547
```
540548

541-
Modify the ConfigMap manifest to match your Network environment. Change the `nginx-hosts` IP address to match your NGINX LB Server IP. If you have 2 or more LB Servers, separate them with a comma. Important! - keep the port number for the Plus API endpoint, and the `/api` URL as shown.
549+
- Modify the ConfigMap manifest to match your Network environment. Change the `nginx-hosts` IP address to match your NGINX LB Server IP. If you have 2 or more LB Servers, separate them with a comma. Important! - keep the port number for the Plus API endpoint, and the `/api` URL as shown.
542550

543551
```yaml
544552
apiVersion: v1
@@ -557,7 +565,7 @@ Apply the updated ConfigMap:
557565
kubectl apply -f nkl-configmap.yaml
558566
```
559567

560-
Deploy the NKL Controller:
568+
- Deploy the NKL Controller:
561569

562570
```bash
563571
kubectl apply -f nkl-deployment.yaml
@@ -611,19 +619,22 @@ Instead, use the `loadbalancer-cluster1.yaml` or `nodeport-cluster1.yaml` manife
611619
# NKL LoadBalancer Service file
612620
# Spec -ports name must be in the format of
613621
# nkl-<upstream-block-name>
622+
# The nginxinc.io Annotation must be added
614623
# externalIPs are set to Nginx LB Servers
615-
# Chris Akker, Jan 2023
624+
# Chris Akker, Apr 2023
616625
#
617626
apiVersion: v1
618627
kind: Service
619628
metadata:
620629
name: nginx-ingress
621630
namespace: nginx-ingress
631+
annotations:
632+
nginxinc.io/nkl-cluster1-https: "http" # Must be added
622633
spec:
623634
type: LoadBalancer
624635
externalIPs:
625-
- 10.1.1.4 # Nginx LB1 Server
626-
- 10.1.1.5 # Nginx LB2 Server
636+
- 10.1.1.4
637+
- 10.1.1.5
627638
ports:
628639
- port: 443
629640
targetPort: 443
@@ -643,7 +654,7 @@ kubectl apply -f loadbalancer-cluster1.yaml
643654
![NKL Cluster1 Loadbalancer](..//media/nkl-cluster1-add-loadbalancer.png)
644655

645656
Legend:
646-
- Orange is the LoadBalancer Service `External-IP`, which are your Nginx LB Server IPs
657+
- Orange is the LoadBalancer Service `External-IP`, which are your Nginx LB Server IP(s).
647658
- Blue is the `NodePort mapping` created by K8s. The new NKL Controller updates the Nginx LB Server upstreams with these, shown on the dashboard.
648659

649660
<br/>
@@ -667,24 +678,25 @@ Review the new `nodeport-cluster1.yaml` Service defintion file:
667678

668679
```yaml
669680
# NKL Nodeport Service file
670-
# Chris Akker, Apr 2023
671681
# NodePort -ports name must be in the format of
672-
#
673-
## nkl-<upstream-block-name> ##
674-
#
682+
# nkl-<upstream-block-name>
683+
# The nginxinc.io Annotation must be added
684+
# Chris Akker, Apr 2023
675685
#
676686
apiVersion: v1
677687
kind: Service
678688
metadata:
679689
name: nginx-ingress
680690
namespace: nginx-ingress
691+
annotations:
692+
nginxinc.io/nkl-cluster1-https: "http" # Must be added
681693
spec:
682694
type: NodePort
683695
ports:
684696
- port: 443
685697
targetPort: 443
686698
protocol: TCP
687-
name: nkl-cluster1-https # This must match NGINX upstream name
699+
name: nkl-cluster1-https
688700
selector:
689701
app: nginx-ingress
690702

@@ -759,7 +771,7 @@ Open a browser tab to https://cafe.example.com/coffee.
759771

760772
The Dashboard's `HTTP Upstreams Requests counters` will increase as you refresh the browser page.
761773

762-
Using a Terminal and `./kube Context set for Cluster1`, delete the `nginx-ingress loadbalancer service` or `nginx-ingress nodeport service` definition.
774+
- Using a Terminal and `./kube Context set for Cluster1`, delete the `nginx-ingress loadbalancer service` or `nginx-ingress nodeport service` definition.
763775

764776
```bash
765777
kubectl delete -f loadbalancer-cluster1.yaml
@@ -781,19 +793,25 @@ Legend:
781793

782794
If you refresh the cafe.example.com browser page, 1/2 of the requests will respond with `502 Bad Gateway`. There are NO upstreams in Cluster1 for NGINX to send the requests to!
783795

784-
Add the `nginx-ingress` Service back to Cluster1:
796+
---
785797

786-
```
798+
- Add the `nginx-ingress` Service back to Cluster1:
799+
800+
```bash
787801
kubectl apply -f loadbalancer-cluster1.yaml
788802
```
789803
or
790-
```
804+
```bash
791805
kubectl apply -f nodeport-cluster1.yaml
792806
```
793807

794-
Verify the nginx-ingress Service is re-created. Notice the the Port Numbers have changed!
808+
- Verify the nginx-ingress Service is re-created. Notice the the Port Numbers have changed!
809+
810+
```bash
811+
kubectl get svc nginx-ingress -n nginx-ingress
812+
```
795813

796-
`The NKL Controller detects this change, and modifies the LB Server(s) upstreams to match.` The Dashboard will show you the new Port numbers, matching the new NodePorts. The NKL logs show these messages, confirming the changes:
814+
`The NKL Controller detects this change, and modifies the LB Server(s) upstreams to match.` The Dashboard will show you the new Port numbers, matching the new LoadBalancer or NodePort definitions. The NKL logs show these messages, confirming the changes:
797815

798816
![NKL Add NodePort](../media/nkl-cluster1-add-nodeport.png)
799817

docs/http/loadbalancer-cluster1.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ kind: Service
99
metadata:
1010
name: nginx-ingress
1111
namespace: nginx-ingress
12+
annotations:
13+
nginxinc.io/nkl-cluster1-https: "http" # Must be added
1214
spec:
1315
type: LoadBalancer
1416
externalIPs:

docs/http/loadbalancer-cluster2.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ kind: Service
99
metadata:
1010
name: nginx-ingress
1111
namespace: nginx-ingress
12+
annotations:
13+
nginxinc.io/nkl-cluster2-https: "http" # Must be added
1214
spec:
1315
type: LoadBalancer
1416
externalIPs:

docs/http/nginx.conf

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Nginx K8s Loadbalancer Solution
22
# Chris Akker, Apr 2023
33
# Example nginx.conf
4-
# Enable Prometheus NJS module, increase output buffer size
4+
# Enable NJS module for Prometheus, increase output buffer size
55
# Enable Stream context, add /var/log/nginx/stream.log
66
#
77
user nginx;
@@ -10,7 +10,7 @@ worker_processes auto;
1010
error_log /var/log/nginx/error.log notice;
1111
pid /var/run/nginx.pid;
1212

13-
load_module modules/ngx_http_js_module.so;
13+
load_module modules/ngx_http_js_module.so; # Added for Prometheus
1414

1515
worker_rlimit_nofile 2048;
1616

@@ -38,16 +38,17 @@ http {
3838

3939
include /etc/nginx/conf.d/*.conf;
4040

41-
#added for Prometheus
42-
subrequest_output_buffer_size 32k;
41+
subrequest_output_buffer_size 32k; #added for Prometheus
4342

4443
}
4544

46-
4745
# TCP load balancing block
4846
#
4947
stream {
50-
include /etc/nginx/stream/*.conf;
51-
log_format stream '$remote_addr - $server_addr [$time_local] $status $upstream_addr $upstream_bytes_sent';
52-
access_log /var/log/nginx/stream.log stream;
48+
49+
include /etc/nginx/stream/*.conf;
50+
51+
log_format stream '$remote_addr - $server_addr [$time_local] $status $upstream_addr $upstream_bytes_sent';
52+
53+
access_log /var/log/nginx/stream.log stream;
5354
}

docs/http/nodeport-cluster1.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# NKL Nodeport Service file
22
# NodePort -ports name must be in the format of
33
# nkl-<upstream-block-name>
4+
# The nginxinc.io Annotation must be added
45
# Chris Akker, Apr 2023
56
#
67
apiVersion: v1
78
kind: Service
89
metadata:
910
name: nginx-ingress
1011
namespace: nginx-ingress
12+
annotations:
13+
nginxinc.io/nkl-cluster1-https: "http" # Must be added
1114
spec:
1215
type: NodePort
1316
ports:

0 commit comments

Comments
 (0)