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

Commit dd61a2a

Browse files
committed
add prometheus
1 parent e58f040 commit dd61a2a

File tree

2 files changed

+34
-19
lines changed

2 files changed

+34
-19
lines changed

docs/http/http-installation-guide.md

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ A standard K8s cluster is all that is required, two or more Clusters if you want
8080

8181
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

@@ -205,7 +205,7 @@ https://www.nginx.com/free-trial-request/
205205
- Plus Dashboard enabled, used for testing, monitoring, and visualization of the Solution working.
206206
- The `http` context is used for MultiCluster Loadbalancing, for HTTP/S processing, Split Clients ratio, and prometheus exporting.
207207
- Plus KeyValue store is configured, to hold the dynamic Split ratio metadata.
208-
- Plus Zone Sync on Port 9001 is configured, to synchronize the dynamic KVstore data between multiple NGINX LB Servers.
208+
- Plus Zone Sync on Port 9001 is configured, to synchronize the dynamic KeyVal data between multiple NGINX LB Servers.
209209

210210
<br/>
211211

@@ -516,7 +516,7 @@ server {
516516

517517
```
518518

519-
- High Availability: If you have 2 or more NGINX Plus LB Servers, you can use Zone Sync to synchronize the Split Key Value Store 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, and reload NGINX. Note: This example does not provide any security for the Zone Sync traffic, secure as necessary with TLS or IP allowlist.
519+
- 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, and reload NGINX. Note: This example does not provide any security for the Zone Sync traffic, secure as necessary with TLS or IP allowlist.
520520

521521
```bash
522522
cat zonesync.conf
@@ -535,15 +535,15 @@ server {
535535

536536
listen 9001;
537537

538-
# cluster of 2 nodes
538+
# Zone Sync with 2 nodes
539539
zone_sync_server 10.1.1.4:9001;
540540
zone_sync_server 10.1.1.5:9001;
541541

542542
}
543543

544544
```
545545

546-
Watching the NGINX Plus Dashboard, you will see messages sent/received if Zone Synch is operating correctly:
546+
Watching the NGINX Plus Dashboard, Cluster Tab, you will see messages sent/received if Zone Sync is operating correctly:
547547

548548
![Zone Sync](../media/nkl-zone-sync.png)
549549

@@ -557,7 +557,7 @@ Watching the NGINX Plus Dashboard, you will see messages sent/received if Zone S
557557

558558
<br/>
559559

560-
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 when there are changes. It only requires three things.
560+
### 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 when there are changes. It only requires three things:
561561

562562
- New kubernetes namespace and RBAC
563563
- NKL ConfigMap, to configure the Controller
@@ -642,7 +642,7 @@ kubectl get svc nginx-ingress -n nginx-ingress
642642
![NGINX Ingress NodePort Service](../media/nkl-cluster1-nodeport.png)
643643
![NGINX Ingress NodePort Service](../media/nkl-cluster1-upstreams.png)
644644

645-
### NodePort is 443:30267, K8s Workers are 10.1.1.8 and .10.
645+
### NodePort mapping is 443:30267, K8s Workers are 10.1.1.8 and .10.
646646

647647
<br/>
648648
<br/>
@@ -674,7 +674,7 @@ Cluster2 Worker Node addresses are:
674674
- 10.1.1.11
675675
- 10.1.1.12
676676

677-
Notice: K8s Control Nodes are excluded from the list intentionally.
677+
Note: K8s Control Nodes are excluded from the list intentionally.
678678

679679
<br/>
680680

@@ -696,7 +696,7 @@ Using a Terminal and `./kube Context set for Cluster1`, delete the `nginx-ingres
696696
kubectl delete -f nodeport-cluster1.yaml
697697
```
698698

699-
Now the `nginx-ingress` Service is gone, and the Cluster1 upstream list will now be empty in the Dashboard.
699+
Now the `nginx-ingress` Service is gone, and the Cluster1 upstream list will now be empty in the Dashboard. The NKL Logs will show that it has `DELETED` the upstream servers!
700700

701701
![NGINX No Cluster1 NodePort](../media/nkl-cluster1-delete-nodeport.png)
702702
Legend:
@@ -724,27 +724,38 @@ Verify the nginx-ingress Service is re-created. Notice the the Port Numbers hav
724724

725725
## 7. Testing MultiCluster Loadbalancing with HTTP Split Clients
726726

727+
<br/>
728+
727729
In this section, you will generate some HTTP load on the NGINX LB Server, and watch as it sends traffic to both Clusters. Then you will `dynamically change the Split ratio`, and watch NGINX send different traffic levels to each cluster.
728730

729731
The only tool you need for this, is an HTTP load generation tool. WRK, running in a docker container outside the cluster is what is shown here.
730732

731733
Start WRK, on a client outside the cluster. This command runs WRK for 15 minutes, targets the NGINX LB Server URL of https://10.1.1.4/coffee. The host header is required, cafe.example.com, as NGINX is configured for this server_name. (And so is the NGINX Ingress Controller).
732734

735+
In these test examples, the Nginx LB Servers and IPs in the hosts file are:
736+
737+
```bash
738+
cat /etc/hosts
739+
740+
nginxlb 10.1.1.4
741+
nginxlb2 10.1.1.5
742+
```
743+
733744
```bash
734745
docker run --rm williamyeh/wrk -t2 -c200 -d15m -H 'Host: cafe.example.com' --timeout 2s https://10.1.1.4/coffee
735746
```
736747

737748
![nkl Clusters 50-50](../media/nkl-clusters-50.png)
738749

739-
You see the traffic is load balanced between cluster1 and cluster2 at 50/50 ratio.
750+
You see the traffic is load balanced between cluster1 and cluster2 at 50:50 ratio.
740751

741-
Add a record to the KV store, by sending an API command to NGINX Plus:
752+
Add a record to the KeyValue store, by sending an API command to NGINX Plus:
742753

743754
```bash
744755
curl -iX POST -d '{"cafe.example.com":50}' http://nginxlb:9000/api/8/http/keyvals/split
745756
```
746757

747-
Verify the API record is there, on both NGINX LB Servers:
758+
Verify the `split KeyVal record` is there, on both NGINX LB Servers:
748759
```bash
749760
curl http://nginxlb:9000/api/8/http/keyvals/split
750761
curl http://nginxlb2:9000/api/8/http/keyvals/split
@@ -754,11 +765,11 @@ curl http://nginxlb2:9000/api/8/http/keyvals/split
754765

755766
If the KV data is missing on one LB Server, your Zone Sync must be fixed.
756767

757-
>Notice the difference in HTTP Response Times, Cluster2 is running much faster than Cluster1 ! (The Red and Green highlights on the Dashboard)
768+
>Notice the difference in HTTP Response Times in the Dashboard, highlighted in Red and Green: Cluster2 is responding much faster than Cluster1! (The Red and Green highlights on the Dashboard).
758769
759-
So, you decide to send less traffic to Cluster1, and more to Cluster2. You will set the HTTP Split ratio to 10/90 = 10% to Cluster1, 90% to Cluster2.
770+
So, you decide to send less traffic to Cluster1, and more to Cluster2. You will set the HTTP Split ratio to 10:90 = 10% to Cluster1, 90% to Cluster2.
760771

761-
Remember: This Solution example configures NGINX for Cluster1 to use the Split value, and the remaining percentage of traffic is sent to Cluster2.
772+
Remember: This Split Clients example configures NGINX for Cluster1 to use the Split KeyValue, and the remaining percentage of traffic is sent to Cluster2.
762773

763774
Change the KV Split Ratio to 10:
764775
```bash
@@ -783,8 +794,6 @@ The Completes the Testing Section.
783794

784795
<br/>
785796

786-
Prometheus | Grafana
787-
788797
![](../media/prometheus-icon.png) |![](../media/grafana-icon.png)
789798
--- | ---
790799

@@ -826,7 +835,13 @@ scrape_configs:
826835
sudo docker run --restart always --network="host" -d -p 9090:9090 --name=prometheus -v ~/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
827836
```
828837

829-
Prometheus Web Console access to the data is on <monitor-server-ip:9090>.
838+
Prometheus Web Console access to the data is on http://<monitor-server-ip:9090>.
839+
840+
Explore some of the metrics available. Try a query for `nginxplus_upstream_server_response_time`:
841+
842+
![NGINX Prom HTTP Requests](../media/prometheus-upstreams.png)
843+
844+
>Wow, look at the variance in performance!
830845

831846
<br/>
832847

@@ -844,7 +859,7 @@ docker volume create grafana-storage
844859
sudo docker run --restart always -d -p 3000:3000 --name=grafana -v grafana-storage:/var/lib/grafana grafana/grafana
845860
```
846861

847-
Web console access to Grafana is on <monitor-server-ip:3000>. Login is admin/admin.
862+
Web console access to Grafana is on http://<monitor-server-ip:3000>. Login is admin/admin.
848863

849864
You can import the provided `grafana-dashboard.json` file to see the NGINX Plus `Cluster1 and 2 statistics` HTTP RPS and Upstream Response Times.
850865

358 KB
Loading

0 commit comments

Comments
 (0)