adamant-kite-43734
12/14/2023, 2:08 PMwide-author-88664
12/14/2023, 10:14 PMss -tlnp
show nothing on port 80 listening... I then did a describe on one of the Rancher pods, and see:
│
│ Controlled By: ReplicaSet/rancher-759c4b7989 │
│ Containers: │
│ rancher: │
│ Container ID: <containerd://31eac66f8d7b59b159f10b54f6636525f755591e04d2b950ce57d8f7247b0a7>8 │
│ Image: rancher/rancher:v2.8.0 │
│ Image ID: <http://docker.io/rancher/rancher@sha256:cf1d155c609894c940e05bc75dd35038bb13a5aa776c3e30deb32b7d123bbf63|docker.io/rancher/rancher@sha256:cf1d155c609894c940e05bc75dd35038bb13a5aa776c3e30deb32b7d123bbf63> │
│ Port: 80/TCP │
│ Host Port: 0/TCP │
│ Args: │
│ --no-cacerts │
│ --http-listen-port=80 │
│ --https-listen-port=443 │
│ --add-local=true │
│ State: Running │
│ Started: Wed, 13 Dec 2023 22:28:48 +0000 │
│ Ready: True
wide-author-88664
12/14/2023, 10:29 PMbillions-vase-14972
12/19/2023, 3:18 PMUpgrade
and Connection
in your site's conf:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name <HOST>;
location / {
proxy_pass <IP>;
include proxy_params;
# ws proxy
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
wide-author-88664
12/20/2023, 12:15 AM# Config from: <https://ranchermanager.docs.rancher.com/getting-started/installation-and-upgrade/installation-references/helm-chart-options#external-tls-termination>
worker_processes 4;
worker_rlimit_nofile 40000;
events {
worker_connections 8192;
}
http {
upstream rancher {
server [redacted].104:80;
server [redacted].105:80;
}
map $http_upgrade $connection_upgrade {
default Upgrade;
'' close;
}
server {
listen 443 ssl http2;
server_name [redacted];
ssl_certificate /etc/ssl/certs/rancher.pem;
ssl_certificate_key /etc/ssl/private/rancher-lb_private.key;
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass <http://rancher>;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
# This allows the ability for the execute shell window to remain open for up to 15 minutes. Without this parameter, the default is 1 minute and will automatically close.
proxy_read_timeout 900s;
proxy_buffering off;
}
}
server {
listen 80;
server_name [redacted];
return 301 https://$server_name$request_uri;
}
}
wide-author-88664
12/20/2023, 12:16 AMwide-author-88664
12/20/2023, 2:45 AMERR_TOO_MANY_REDIRECTS
in my client browser.
I did a packet capture and this is what I see between the LB and the client:
6 12.808488 [client_ip] [nginx_lb_ip] TLSv1.3 929 Client Hello (SNI=rancher.[redacted].com)
8 12.809375 [nginx_lb_ip] [client_ip] TLSv1.3 292 Server Hello, Change Cipher Spec, Encrypted Extensions, Finished
9 12.810329 [client_ip] [nginx_lb_ip] TLSv1.3 84 Change Cipher Spec, Alert (Level: Fatal, Description: Certificate Unknown)
17 12.823759 [client_ip] [nginx_lb_ip] TLSv1.3 833 Client Hello (SNI=rancher.[redacted].com)
19 12.824583 [nginx_lb_ip] [client_ip] TLSv1.3 292 Server Hello, Change Cipher Spec, Encrypted Extensions, Finished
20 12.825726 [client_ip] [nginx_lb_ip] TLSv1.3 84 Change Cipher Spec, Alert (Level: Fatal, Description: Certificate Unknown)
28 12.853870 [client_ip] [nginx_lb_ip] TLSv1.3 658 Client Hello (SNI=rancher.[redacted].com)
30 12.861904 [nginx_lb_ip] [client_ip] TLSv1.3 2974 Server Hello, Change Cipher Spec, Encrypted Extensions
31 12.861911 [nginx_lb_ip] [client_ip] TLSv1.3 1230 Certificate
32 12.861930 [nginx_lb_ip] [client_ip] TLSv1.3 234 Certificate Verify, Finished
34 12.863046 [client_ip] [nginx_lb_ip] TLSv1.3 118 Change Cipher Spec, Finished
35 12.863165 [nginx_lb_ip] [client_ip] TLSv1.3 325 New Session Ticket
36 12.863192 [client_ip] [nginx_lb_ip] HTTP2 146 Magic, SETTINGS[0], WINDOW_UPDATE[0]
37 12.863206 [nginx_lb_ip] [client_ip] TLSv1.3 325 New Session Ticket
38 12.863230 [nginx_lb_ip] [client_ip] HTTP2 125 SETTINGS[0], WINDOW_UPDATE[0], SETTINGS[0]
39 12.863392 [client_ip] [nginx_lb_ip] HTTP2 536 HEADERS[1]: GET /
41 12.864113 [client_ip] [nginx_lb_ip] HTTP2 85 SETTINGS[0]
43 12.866099 [nginx_lb_ip] [client_ip] HTTP2 241 HEADERS[1]: 302 Found, DATA[1]
44 12.866138 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[1] (text/html)
46 12.869519 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[3]: GET /
47 12.872228 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[3]: 302 Found, DATA[3]
48 12.872269 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[3] (text/html)
50 12.874931 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[5]: GET /
51 12.876936 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[5]: 302 Found, DATA[5]
52 12.876968 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[5] (text/html)
54 12.879714 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[7]: GET /
55 12.881672 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[7]: 302 Found, DATA[7]
56 12.881706 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[7] (text/html)
58 12.884488 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[9]: GET /
59 12.886139 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[9]: 302 Found, DATA[9]
60 12.886191 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[9] (text/html)
62 12.889129 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[11]: GET /
63 12.891019 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[11]: 302 Found, DATA[11]
64 12.891059 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[11] (text/html)
66 12.893966 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[13]: GET /
67 12.895900 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[13]: 302 Found, DATA[13]
68 12.895944 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[13] (text/html)
70 12.898786 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[15]: GET /
71 12.900778 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[15]: 302 Found, DATA[15]
72 12.900831 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[15] (text/html)
74 12.903734 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[17]: GET /
75 12.905502 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[17]: 302 Found, DATA[17]
76 12.905564 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[17] (text/html)
78 12.908517 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[19]: GET /
79 12.910819 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[19]: 302 Found, DATA[19]
80 12.910900 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[19] (text/html)
82 12.913791 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[21]: GET /
83 12.915827 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[21]: 302 Found, DATA[21]
84 12.915915 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[21] (text/html)
86 12.918769 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[23]: GET /
87 12.920919 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[23]: 302 Found, DATA[23]
88 12.921008 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[23] (text/html)
90 12.923812 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[25]: GET /
91 12.925906 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[25]: 302 Found, DATA[25]
92 12.925995 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[25] (text/html)
94 12.929410 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[27]: GET /
95 12.931714 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[27]: 302 Found, DATA[27]
96 12.931810 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[27] (text/html)
98 12.934654 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[29]: GET /
99 12.936535 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[29]: 302 Found, DATA[29]
100 12.936628 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[29] (text/html)
102 12.939890 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[31]: GET /
103 12.942059 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[31]: 302 Found, DATA[31]
104 12.942165 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[31] (text/html)
106 12.945487 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[33]: GET /
107 12.947468 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[33]: 302 Found, DATA[33]
108 12.947556 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[33] (text/html)
110 12.950897 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[35]: GET /
111 12.953143 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[35]: 302 Found, DATA[35]
112 12.953234 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[35] (text/html)
114 12.956098 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[37]: GET /
115 12.958049 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[37]: 302 Found, DATA[37]
116 12.958177 [nginx_lb_ip] [client_ip] HTTP2 85 DATA[37] (text/html)
118 12.960983 [client_ip] [nginx_lb_ip] HTTP2 107 HEADERS[39]: GET /
119 12.963162 [nginx_lb_ip] [client_ip] HTTP2 240 HEADERS[39]: 302 Found, DATA[39]
billions-vase-14972
12/20/2023, 1:10 PMI'm curious if yourCopy code9 12.810329 [client_ip] [nginx_lb_ip] TLSv1.3 84 Change Cipher Spec, Alert (Level: Fatal, Description: Certificate Unknown)
ssl_certificate_key
file with the .key
extension is causing issues. According to the nginx docs, the secret key should be in the PEM format, also the Rancher docs you linked referenced a pem file. Could be unrelated but worth a check at least.wide-author-88664
12/20/2023, 1:17 PMwide-author-88664
12/20/2023, 1:18 PM-----BEGIN PRIVATE KEY-----
[redacted]
-----END PRIVATE KEY-----
wide-author-88664
12/20/2023, 1:22 PMwide-author-88664
12/20/2023, 1:30 PMhelm install \
rancher rancher-latest/rancher \
--version 2.8.0 \
--namespace cattle-system \
--set hostname=rancher.[redacted].com \
--set bootstrapPassword=[redacted] \
--set tls=external \
--kubeconfig /etc/rancher/k3s/k3s.yaml
NAME: rancher
LAST DEPLOYED: Wed Dec 13 22:27:50 2023
NAMESPACE: cattle-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Rancher Server has been installed.
billions-vase-14972
12/20/2023, 1:50 PMhttps://<rancher-ip>/dashboard
. There could be a few other things to check, the ingress options to use the forwarded headers depending on your nginx version, also this note in the docs:
note
If you are using a Private CA signed certificate, addand see Adding TLS Secrets - Using a Private CA Signed Certificate to add the CA cert for Rancher.--set privateCA=true
wide-author-88664
12/20/2023, 1:51 PM--set tls=external
does Rancher publish out on 443, or just 80?billions-vase-14972
12/20/2023, 1:52 PMbillions-vase-14972
12/20/2023, 1:53 PMwide-author-88664
12/20/2023, 1:58 PMroot@rancher-lb:~# curl http://[k3s_host_running_rancher_ip]/dashboard
404 page not found
root@rancher-lb:~# curl --insecure -I https://[k3s_host_running_rancher_ip]/dashboard
HTTP/2 404
content-type: text/plain; charset=utf-8
x-content-type-options: nosniff
content-length: 19
date: Wed, 20 Dec 2023 13:55:13 GMT
wide-author-88664
12/20/2023, 2:02 PMwide-author-88664
12/20/2023, 2:03 PMbillions-vase-14972
12/20/2023, 2:12 PMbillions-vase-14972
12/20/2023, 2:15 PMbroad-ambulance-17822
12/20/2023, 2:31 PMtls=external
normally means Rancher will listen on port 80 and expects TLS to be terminated outside of the cluster somehow (on the LB)broad-ambulance-17822
12/20/2023, 2:36 PMbroad-ambulance-17822
12/20/2023, 2:38 PMwide-author-88664
12/20/2023, 6:04 PMrancher-lb
(CNAME rancher
) - LB proxy to above
Then on the NGINX LB config on rancher-lb, what do I use in the config to reach Rancher running on the K8s cluster?wide-author-88664
12/20/2023, 6:07 PMk3s-node-1
and k3s-node-2
broad-ambulance-17822
12/20/2023, 6:17 PMserver-url
to use, that should be the CNAME rancher you’re referring tobroad-ambulance-17822
12/20/2023, 6:18 PMbroad-ambulance-17822
12/20/2023, 6:20 PMwide-author-88664
12/20/2023, 6:20 PM--set hostname=rancher.[redacted].com
wide-author-88664
12/20/2023, 6:21 PMbroad-ambulance-17822
12/20/2023, 6:21 PMwide-author-88664
12/20/2023, 6:34 PMwide-author-88664
12/20/2023, 6:35 PMwide-author-88664
12/20/2023, 6:36 PMbroad-ambulance-17822
12/20/2023, 6:37 PMk3s-node-1
or k3s-node-2
directly, going “around” the load balancer, you need to use <http://rancher.some-domain.com|rancher.some-domain.com>
broad-ambulance-17822
12/20/2023, 6:37 PM<http://rancher.some-domain.com|rancher.some-domain.com>
on port 80wide-author-88664
12/20/2023, 6:38 PMbroad-ambulance-17822
12/20/2023, 6:38 PMwide-author-88664
12/20/2023, 6:40 PMwide-author-88664
12/20/2023, 6:41 PMERR_TOO_MANY_REDIRECTS
and so I'd think that the config is messed up somewherebroad-ambulance-17822
12/20/2023, 6:46 PMbroad-ambulance-17822
12/20/2023, 6:48 PMwide-author-88664
12/20/2023, 7:45 PMbillions-vase-14972
12/21/2023, 1:02 PMCopy code6 12.808488 [client_ip] [nginx_lb_ip] TLSv1.3 929 Client Hello (SNI=rancher.[redacted].com)
wide-author-88664
12/21/2023, 1:05 PMwide-author-88664
12/21/2023, 1:07 PMbillions-vase-14972
12/21/2023, 6:52 PM"--entryPoints.web.forwardedHeaders.insecure"
to the traefik-config by creating a `HelmChartConfig` .
The file should look like:
# ./traefik-config.yml
apiVersion: <http://helm.cattle.io/v1|helm.cattle.io/v1>
kind: HelmChartConfig
metadata:
name: traefik
namespace: kube-system
spec:
valuesContent: |-
additionalArguments:
- "--entryPoints.web.forwardedHeaders.insecure"
Then just run kubectl apply -f traefik-config.yml
wide-author-88664
12/21/2023, 11:25 PMwide-author-88664
12/21/2023, 11:27 PMwide-author-88664
12/21/2023, 11:39 PMwide-author-88664
12/21/2023, 11:40 PMbillions-vase-14972
12/22/2023, 1:13 PM