Kubernetes – Fixing Rancher 404 Page Not Found Error

kubernetesrancher-2

I installed a kubernetes cluster with k3sup on a VM on my local hypervisor and the pods are up and running. Now I wanted to add a deployment with rancher in its latest version (2.6) to manage another cluster according to this guide. But the DNS and IP return a 404 not found.

Here are some terminal commands with results that might help.

$kubectl -n cattle-system get deploy rancher
NAME      READY   UP-TO-DATE   AVAILABLE   AGE
rancher   3/3     3            3           5d3h

$kubectl get pods -n cattle-system -o wide
NAME                               READY   STATUS    RESTARTS   AGE     IP           NODE          NOMINATED NODE   READINESS GATES
rancher-webhook-7f84b74ddb-44449   1/1     Running   1          5d20h   10.42.0.44   k8s-rancher   <none>           <none>
rancher-87d4dc99d-94hqb            1/1     Running   20         5d20h   10.42.0.42   k8s-rancher   <none>           <none>
rancher-87d4dc99d-b5fm2            1/1     Running   17         5d20h   10.42.0.45   k8s-rancher   <none>           <none>
rancher-87d4dc99d-dxmfl            1/1     Running   17         5d20h   10.42.0.41   k8s-rancher   <none>           <none>

The many restarts come from the missing connection to the websocket, I think.

$kubectl -n cattle-system logs rancher-87d4dc99d-94hqb
... [repeating the connection failure on all 3 pods]
2021/10/04 23:29:13 [ERROR] Failed to connect to peer wss://10.42.0.45/v3/connect [local ID=10.42.0.42]: dial tcp 10.42.0.45:443: connect: no route to host

In the container I can not reach the IP of another server.

$kubectl exec --stdin -n cattle-system --tty rancher-87d4dc99d-94hqb -- /bin/bash
[in the container]$ curl 10.42.0.45
curl: (7) Failed to connect to 10.42.0.45 port 80: No route to host

What can I do to get it working?
Thanks in advance for the help.

Best Answer

As the problem has already been resolved in the comments section, I decided to provide a Community Wiki answer just for better visibility to other community members.

The commands/steps listed on this page are really useful for checking network related issues in the cluster.

First, I recommend checking that all the required ports are open in your (host) firewall as described here.

Related Topic