nginx负载均衡配置
http {
upstream docker {
server 192.168.88.106:10001;
server 192.168.88.106:10002;
server 192.168.88.106:10003;
}
server {
listen 81;
server_name localhost;
location / {
proxy_pass http://docker;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
## 七层负载均衡,写在http{}里面: #upstream kube-apiserver { # server 121.52.238.150:6443; # server 61.130.9.196:6443; #} #server { # listen 6443; # server_name localhost; # location / { # proxy_pass http://kube-apiserver; # proxy_set_header Host $host; # proxy_set_header X-Real-IP $remote_addr; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # } #} ## 四层负载均衡,写在http{}外面: stream { upstream kube-apiserver { server 121.52.238.150:6443; server 61.130.9.196:6443; } server { listen 6443; proxy_pass kube-apiserver; } }
一些事情一直在干,说不定以后就结果了呢
本文来自博客园,作者:chenjianwen,转载请注明原文链接:https://www.cnblogs.com/chenjw-note/p/6820507.html