Reputation: 293
I installed rancher and k3s on 3 VMs: 192.168.0.150 control plane 192.168.0.151 worker 192.168.0.152 worker
I followed the tutorial https://ranchermanager.docs.rancher.com/how-to-guides/new-user-guides/infrastructure-setup/nginx-load-balancer to configure nginx:
worker_processes 4;
worker_rlimit_nofile 40000;
load_module /usr/lib/nginx/modules/ngx_stream_module.so;
events {
worker_connections 8192;
}
stream {
upstream rancher_servers_http {
least_conn;
server 192.168.0.150:80 max_fails=3 fail_timeout=5s;
server 192.168.0.151:80 max_fails=3 fail_timeout=5s;
server 192.168.0.152:80 max_fails=3 fail_timeout=5s;
}
server {
listen 80;
proxy_pass rancher_servers_http;
}
}
http {
upstream rancher_servers_https {
least_conn;
server 192.168.0.150:443 max_fails=3 fail_timeout=5s;
server 192.168.0.151:443 max_fails=3 fail_timeout=5s;
server 192.168.0.152:443 max_fails=3 fail_timeout=5s;
}
server {
listen 443 ssl;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_certificate /cert/tls.crt;
ssl_certificate_key /cert/tls.key;
ssl_trusted_certificate /cert/cacerts.pem;
error_log /var/log/nginx/rancher_error_log error;
location / {
proxy_pas https://rancher_servers_https;
proxy_set_header Host rancher.example.org;
proxy_ssl_server_name on;
proxy_ssl_name rancher.example.org;
add_header Access-Control-Allow-Origin *;
}
}
}
I access Rancher and I get the login page using the url example.org
but I get the following errors when I try to connect:
"An error occurred logging in: Network Error"
and in my browser debugger: "Access to XMLHttpRequest at 'https://rancher.example.org/v3-public/localProviders/local?action=login' from origin 'https://example.org' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource."
what did i forget to do?
Thanks for your help
Upvotes: 0
Views: 71