Created
January 23, 2020 17:18
-
-
Save jspaleta/5a5f68f51cdeb77af5e6dce5fbbb3f96 to your computer and use it in GitHub Desktop.
Basic Sensu Go Cluster LoadBalancer
This file contains hidden or 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
# Example of Basic Sensu Go Load Balancer | |
# Load balancer for backend api | |
# Default port is 8080 | |
upstream sensu_api { | |
# Clients with the same IP are redirected to the same backend | |
ip_hash; | |
# Available backend servers | |
server 192.168.50.20:8080; | |
server 192.168.50.21:8080; | |
server 192.168.50.22:8080; | |
} | |
# Load balancer for dashboard | |
# Default port is 3000 | |
upstream sensu_dashboard { | |
# Clients with the same IP are redirected to the same backend | |
ip_hash; | |
# Available backend servers | |
server 192.168.50.20:3000; | |
server 192.168.50.21:3000; | |
server 192.168.50.22:3000; | |
} | |
# Load balancer for agent websocket | |
# Default port is 8081 | |
upstream sensu_agent_ws { | |
# Clients with the same IP are redirected to the same backend | |
ip_hash; | |
# Available backend servers | |
server 192.168.50.20:8081; | |
server 192.168.50.21:8081; | |
server 192.168.50.22:8081; | |
} | |
# Sensu websocket proxy | |
server { | |
listen 8081; | |
location / { | |
## switch off logging | |
access_log off; | |
# redirect all HTTP traffic to sensu_agent_ws loadbalancer defined above: | |
proxy_pass http://sensu_agent_ws; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
# WebSocket support (nginx 1.4) | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
} | |
# Sensu API proxy | |
server { | |
listen 8080; | |
location / { | |
## switch off logging | |
access_log off; | |
# redirect all HTTP traffic to sensu_api loadbalancer defined above: | |
proxy_pass http://sensu_api; | |
} | |
} | |
# Sensu Dashboard proxy | |
server { | |
listen 3000; | |
location / { | |
## switch off logging | |
access_log off; | |
# redirect all HTTP traffic to sensu_dashboard loadbalancer defined above: | |
proxy_pass http://sensu_dashboard; | |
} | |
} |
i should revisit this and make sure it works with sensu agent mtls support for the websocket api on 8081. I think it should, but i havent tested it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Jef - you are the BOMB for sharing this - many thanks!!!!!