generated from nginxinc/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added icons * added icons * http upgrade * add grafana dashboard * updated diagram
- Loading branch information
1 parent
490a4a5
commit ecbbc53
Showing
22 changed files
with
1,861 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: coffee | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: coffee | ||
template: | ||
metadata: | ||
labels: | ||
app: coffee | ||
spec: | ||
containers: | ||
- name: coffee | ||
image: nginxinc/ingress-demo # upgraded Cafe Docker image | ||
ports: | ||
- containerPort: 80 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: coffee-svc | ||
spec: | ||
type: ClusterIP | ||
clusterIP: None | ||
ports: | ||
- port: 80 | ||
targetPort: 80 | ||
protocol: TCP | ||
name: http | ||
selector: | ||
app: coffee | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: tea | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: tea | ||
template: | ||
metadata: | ||
labels: | ||
app: tea | ||
spec: | ||
containers: | ||
- name: tea | ||
image: nginxinc/ingress-demo | ||
ports: | ||
- containerPort: 80 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: tea-svc | ||
labels: | ||
spec: | ||
type: ClusterIP | ||
clusterIP: None | ||
ports: | ||
- port: 80 | ||
targetPort: 80 | ||
protocol: TCP | ||
name: http | ||
selector: | ||
app: tea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# NginxK8sLB HTTP configuration, for L7 load balancing | ||
# Chris Akker, Apr 2023 | ||
# HTTP Proxy and load balancing | ||
# 2 k8s Clusters LB with http split clients | ||
# Nginx Kubernetes Loadbalancer | ||
# Upstream servers managed by NKL Controller | ||
# Nginx Key Value store for Split ratios | ||
# | ||
#### clusters.conf | ||
|
||
# Define Key Value store, backup state file, timeout, and enable sync | ||
|
||
keyval_zone zone=split:1m state=/var/lib/nginx/state/split.keyval timeout=30d sync; | ||
keyval $host $split_level zone=split; | ||
|
||
# Main Nginx Server Block for cafe.example.com, with TLS | ||
|
||
server { | ||
listen 443 ssl; | ||
status_zone https://cafe.example.com; | ||
server_name cafe.example.com; | ||
|
||
ssl_certificate /etc/ssl/nginx/default.crt; | ||
ssl_certificate_key /etc/ssl/nginx/default.key; | ||
|
||
location / { | ||
status_zone /; | ||
|
||
proxy_set_header Host $host; | ||
proxy_http_version 1.1; | ||
proxy_set_header "Connection" ""; | ||
proxy_pass https://$upstream; | ||
|
||
} | ||
|
||
} | ||
|
||
# Cluster1 upstreams | ||
|
||
upstream cluster1-https { | ||
zone cluster1-https 256k; | ||
least_time last_byte; | ||
server 10.1.1.10:31317; | ||
server 10.1.1.8:31317; | ||
keepalive 16; | ||
#servers managed by NKL | ||
#state /var/lib/nginx/state/cluster1-https.state; | ||
} | ||
|
||
# Cluster2 upstreams | ||
|
||
upstream cluster2-https { | ||
zone cluster2-https 256k; | ||
least_time last_byte; | ||
server 10.1.1.11:31390; | ||
server 10.1.1.12:31390; | ||
#servers managed by NKL | ||
#state /var/lib/nginx/state/cluster2-https.state; | ||
} | ||
|
||
# HTTP Split Clients Configuration for Cluster1/Cluster2 ratios | ||
|
||
split_clients $request_id $split0 { | ||
* cluster2-https; | ||
} | ||
|
||
split_clients $request_id $split1 { | ||
1.0% cluster1-https; | ||
* cluster2-https; | ||
} | ||
|
||
split_clients $request_id $split5 { | ||
5.0% cluster1-https; | ||
* cluster2-https; | ||
} | ||
|
||
split_clients $request_id $split10 { | ||
10% cluster1-https; | ||
* cluster2-https; | ||
} | ||
|
||
split_clients $request_id $split25 { | ||
25% cluster1-https; | ||
* cluster2-https; | ||
} | ||
|
||
split_clients $request_id $split50 { | ||
50% cluster1-https; | ||
* cluster2-https; | ||
} | ||
|
||
split_clients $request_id $split75 { | ||
75% cluster1-https; | ||
* cluster2-https; | ||
} | ||
|
||
split_clients $request_id $split90 { | ||
90% cluster1-https; | ||
* cluster2-https; | ||
} | ||
|
||
split_clients $request_id $split95 { | ||
95% cluster1-https; | ||
* cluster2-https; | ||
} | ||
|
||
split_clients $request_id $split99 { | ||
99% cluster1-https; | ||
* cluster2-https; | ||
} | ||
|
||
split_clients $request_id $split100 { | ||
* cluster1-https; | ||
} | ||
|
||
map $split_level $upstream { | ||
0 $split0; | ||
1.0 $split1; | ||
5.0 $split5; | ||
10 $split10; | ||
25 $split25; | ||
50 $split50; | ||
75 $split75; | ||
90 $split90; | ||
95 $split95; | ||
99 $split99; | ||
100 $split100; | ||
default $split50; | ||
} |
Oops, something went wrong.