rancher: [BUG] Rancher stuck on Waiting for cluster agent to connect after all control-plane VMs restarted

Rancher Server Setup

  • Rancher version: v2.7.2-rc7
  • Installation option (Docker install/Helm Chart): K3s install on a single VM
  • Proxy/Cert Details: N/A

Information about the Cluster

  • Kubernetes version: v1.24.10+k3s1
  • Cluster Type (Local/Downstream): RKE2 cluster with the Harvester provisioner

User Information

  • What is the role of the user logged in? Admin

Describe the bug

I had to reboot the underlying Harvester node which is running all the VMs which Rancher is maintaining. When all provisioned VMs got rebooted, Rancher is unable to get back to a working control plane:

image

Its stuck on:

configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect

Whenever this happens, I’m forced to completely delete the cluster and start fresh since I’m unable to get into the control plane 😦

I noticed this error in the rancher-system-agent errors:

error syncing 'fleet-default/home-bootstrap-template-vfssj-machine-plan': handler secret-watch: the server could not find the requested resource (put secrets.meta.k8s.io home-bootstrap-template-vfssj-machine-plan), requeuing"
```

Logs on `home-control-panel-64fb95f768-vrlxf`:
```
May 10 12:01:38 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:01:38Z" level=info msg="[Applyinator] Command sh [-c rke2 etcd-snapshot list --etcd-s3=false 2>/dev/null] finished with err: <nil> and exit code: 0"
May 10 12:01:43 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:01:43Z" level=error msg="error syncing 'fleet-default/home-bootstrap-template-vfssj-machine-plan': handler secret-watch: the server could not find the requested resource (put secrets.meta.k8s.io home-bootstrap-template-vfssj-machine-plan), requeuing"
May 10 12:01:48 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:01:48Z" level=info msg="[Applyinator] No image provided, creating empty working directory /var/lib/rancher/agent/work/20230510-120148/8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0"
May 10 12:01:48 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:01:48Z" level=info msg="[Applyinator] Running command: sh [-c rke2 etcd-snapshot list --etcd-s3=false 2>/dev/null]"
May 10 12:01:49 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:01:49Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: Name                                                            Location                                                                                                         Size     Created"
May 10 12:01:49 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:01:49Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683608403      file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683608403      98250784 2023-05-09T05:00:04Z"
May 10 12:01:49 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:01:49Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683626400      file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683626400      98250784 2023-05-09T10:00:01Z"
May 10 12:01:49 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:01:49Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683644404      file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683644404      98250784 2023-05-09T15:00:05Z"
May 10 12:01:49 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:01:49Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683662401.part file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683662401.part 13926400 2023-05-09T20:00:22Z"
May 10 12:01:49 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:01:49Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: etcd-snapshot--1683676800.part                                  file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot--1683676800.part                                  0        2023-05-10T00:00:00Z"
May 10 12:01:49 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:01:49Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683576000      file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683576000      98250784 2023-05-08T20:00:01Z"
May 10 12:01:49 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:01:49Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683590402      file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683590402      98250784 2023-05-09T00:00:03Z"
May 10 12:01:50 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:01:50Z" level=info msg="[Applyinator] Command sh [-c rke2 etcd-snapshot list --etcd-s3=false 2>/dev/null] finished with err: <nil> and exit code: 0"
May 10 12:01:55 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:01:55Z" level=error msg="error syncing 'fleet-default/home-bootstrap-template-vfssj-machine-plan': handler secret-watch: the server could not find the requested resource (put secrets.meta.k8s.io home-bootstrap-template-vfssj-machine-plan), requeuing"
May 10 12:02:00 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:02:00Z" level=info msg="[Applyinator] No image provided, creating empty working directory /var/lib/rancher/agent/work/20230510-120200/8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0"
May 10 12:02:00 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:02:00Z" level=info msg="[Applyinator] Running command: sh [-c rke2 etcd-snapshot list --etcd-s3=false 2>/dev/null]"
May 10 12:02:02 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:02:02Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: Name                                                            Location                                                                                                         Size     Created"
May 10 12:02:02 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:02:02Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683590402      file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683590402      98250784 2023-05-09T00:00:03Z"
May 10 12:02:02 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:02:02Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683608403      file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683608403      98250784 2023-05-09T05:00:04Z"
May 10 12:02:02 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:02:02Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683626400      file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683626400      98250784 2023-05-09T10:00:01Z"
May 10 12:02:02 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:02:02Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683644404      file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683644404      98250784 2023-05-09T15:00:05Z"
May 10 12:02:02 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:02:02Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683662401.part file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-home-control-panel-d5c1ddc9-8q5tf-1683662401.part 13926400 2023-05-09T20:00:22Z"
May 10 12:02:02 home-control-panel-d5c1ddc9-8q5tf rancher-system-agent[63918]: time="2023-05-10T12:02:02Z" level=info msg="[8d15054ffe8e5b367f1c42484faa83c3dbd756c78e981a70f99a00967f2a308d_0:stdout]: etcd-snapshot--1683676800.part                                  file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot--1683676800.part                                  0        2023-05-10T00:00:00Z"
```



Rancher logs:
```
β”‚ 2023/05/13 01:33:35 [INFO] [planner] rkecluster fleet-default/home: waiting: configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect                                                                                                                                                                                         β”‚
β”‚ 2023/05/13 01:33:35 [INFO] [planner] rkecluster fleet-default/home: waiting: configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect                                                                                                                                                                                         β”‚
β”‚ 2023/05/13 01:33:36 [ERROR] [CAPI] Unable to retrieve Node status: failed to create cluster accessor: failed to get lock for cluster: cluster is locked already                                                                                                                                                                                                              β”‚
β”‚ 2023/05/13 01:33:36 [ERROR] [CAPI] Unable to retrieve Node status: failed to create cluster accessor: failed to get lock for cluster: cluster is locked already                                                                                                                                                                                                              β”‚
β”‚ 2023/05/13 01:33:36 [ERROR] [CAPI] Unable to retrieve Node status: failed to create cluster accessor: failed to get lock for cluster: cluster is locked already                                                                                                                                                                                                              β”‚
β”‚ 2023/05/13 01:33:40 [ERROR] [CAPI] Unable to retrieve Node status: failed to create cluster accessor: error creating dynamic rest mapper for remote cluster "fleet-default/home": Get "https://10.43.111.50/k8s/clusters/c-m-v9k6nzr4/api?timeout=10s": net/http: request canceled (Client.Timeout exceeded while awaiting headers)                                          β”‚
β”‚ 2023/05/13 01:33:40 [INFO] [planner] rkecluster fleet-default/home: waiting: configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect                                                                                                                                                                                         β”‚
β”‚ 2023/05/13 01:33:40 [INFO] [planner] rkecluster fleet-default/home: waiting: configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect                                                                                                                                                                                         β”‚
β”‚ 2023/05/13 01:33:45 [INFO] [planner] rkecluster fleet-default/home: waiting: configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect                                                                                                                                                                                         β”‚
β”‚ 2023/05/13 01:33:45 [INFO] [planner] rkecluster fleet-default/home: waiting: configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect                                                                                                                                                                                         β”‚
β”‚ 2023/05/13 01:33:50 [INFO] [planner] rkecluster fleet-default/home: waiting: configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect                                                                                                                                                                                         β”‚
β”‚ 2023/05/13 01:33:50 [INFO] [planner] rkecluster fleet-default/home: waiting: configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect                                                                                                                                                                                         β”‚
β”‚ 2023/05/13 01:33:51 [ERROR] [CAPI] Unable to retrieve Node status: failed to create cluster accessor: failed to get lock for cluster: cluster is locked already                                                                                                                                                                                                              β”‚
β”‚ 2023/05/13 01:33:51 [ERROR] [CAPI] Unable to retrieve Node status: failed to create cluster accessor: failed to get lock for cluster: cluster is locked already                                                                                                                                                                                                              β”‚
β”‚ 2023/05/13 01:33:51 [ERROR] [CAPI] Unable to retrieve Node status: failed to create cluster accessor: failed to get lock for cluster: cluster is locked already                                                                                                                                                                                                              β”‚
β”‚ 2023/05/13 01:33:51 [INFO] [planner] rkecluster fleet-default/home: waiting: configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect                                                                                                                                                                                         β”‚
β”‚ 2023/05/13 01:33:51 [INFO] [planner] rkecluster fleet-default/home: waiting: configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect                                                                                                                                                                                         β”‚
β”‚ 2023/05/13 01:33:55 [ERROR] [CAPI] Unable to retrieve Node status: failed to create cluster accessor: failed to get lock for cluster: cluster is locked already                                                                                                                                                                                                              β”‚
β”‚ 2023/05/13 01:33:56 [INFO] [planner] rkecluster fleet-default/home: waiting: configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect                                                                                                                                                                                         β”‚
β”‚ 2023/05/13 01:33:56 [INFO] [planner] rkecluster fleet-default/home: waiting: configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect                                                                                                                                                                                         β”‚
β”‚ 2023/05/13 01:33:58 [ERROR] [CAPI] Unable to retrieve Node status: failed to create cluster accessor: error creating dynamic rest mapper for remote cluster "fleet-default/home": Get "https://10.43.111.50/k8s/clusters/c-m-v9k6nzr4/api?timeout=10s": context deadline exceeded                                                                                            β”‚
β”‚ 2023/05/13 01:34:01 [INFO] [planner] rkecluster fleet-default/home: waiting: configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect                                                                                                                                                                                         β”‚
β”‚ 2023/05/13 01:34:01 [INFO] [planner] rkecluster fleet-default/home: waiting: configuring bootstrap node(s) home-control-panel-64fb95f768-vrlxf: waiting for cluster agent to connect                                                                                                                                                                                         β”‚
β”‚ 2023/05/13 01:34:06 [ERROR] [CAPI] Unable to retrieve Node status: failed to create cluster accessor: failed to get lock for cluster: cluster is locked already                                                                                                                                                                                                              β”‚
β”‚ 2023/05/13 01:34:06 [ERROR] [CAPI] Unable to retrieve Node status: failed to create cluster accessor: failed to get lock for cluster: cluster is locked already        
```

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 34 (3 by maintainers)

Most upvoted comments

Also having this issue v1.28.8+rke2r1

hahha - one person above says rebooted serveral times and it started working. Tried that as i had nothing to lose. And it did start working on the 4th reboot. Amazing

@sarahhenkens, as a workaround

  • had to remove VM ( in my case it was cp+etcd node) manually from underlying infrastructure
  • delete respective node pool, designed to be 1 node pool for each node role ( by removing finalizer )
  • then deploy / add node to the rke2 cluster again I think it has something to do with rancher v2.7.2 & cluster dynamicSchemaSpec

I’m a first time user on Rancher and I spend a week on this already and cant figure out whats going on. Using Racher 2.9.2 (also tried 2.9.1). Creating a new rke2 cluster v1.30.4+rke2r1 and installing the agent on a Ubuntu 24.04 instance. Everything seems fine except Rancher keeps waiting

[Waiting] non-ready bootstrap machine(s) custom-a119461b26b7 and join url to be available on bootstrap node

The only error I can find is on the rancher-system-agent.service

Oct 22 09:28:41 edge-node-1 rancher-system-agent[2422]: W1022 09:28:41.356634    2422 reflector.go:462] pkg/mod/github.com/rancher/client-go@v1.29.3-rancher1/tools/cache/reflector.go:229: watch of *v1.Secret ended with: an error on the server ("unable to decode an event from the watch stream: stream error: stream ID 137; INTERNAL_ERROR; received from peer") has prevented the request from succeeding

@LuisAArce You say its certs, which certs? As well as what did you do to resolve.

Hey maartenschalekamp!

I am on Rancher 2.8.5 on Ubuntu at the moment so results may vary!

Does your DNS server have the CNAME of the Rancher UI ( for example rancher-burger.net)? The pods check /etc/resolve.conf for their DNS so if the CNAME does not exist they will fail. Putting it on the VMs /etc/hosts file will not work (I tried πŸ˜„ )

Also, on the Ubuntu VM I had to install IPTables prior to installing Rancher or else rke2-ingress-nginx-controller would not come up. You can check if all the pods are running the below (assuming you have not changed the default location).

/var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml get pods --all-namespaces

After fixing the above Rancher finally came up.

My next issue was the .crt cert from Digicert was not being recognized as a full chain when creating my dev cluster. I had to export all 3 pieces of the cert and them remake the .crt file and then recreate the secret in Rancher. Once I did that my dev cluster came up.

Below was the error being seen:

`time=β€œ2024-10-09T18:29:34Z” level=fatal msg=β€œCertificate chain is not complete, please check if all needed intermediate certificates are included in the server certificate (in the correct order) and if the cacerts setting in Rancher either contains the correct CA certificate (in the case of using self signed certificates) or is empty (in the case of using a certificate signed by a recognized CA). Certificate information is displayed above. error: Get "https://YOURRANCHERURL": tls: failed to verify certificate: x509: certificate signed by unknown authority”

https://support.tools/post/how-to-change-rancher-2.x-server-cert/ https://ranchermanager.docs.rancher.com/getting-started/installation-and-upgrade/resources/update-rancher-certificate

Same issue on v1.28.9+rke2r1

I haven’t experienced the issue anymore

On Wed, Sep 6, 2023 at 2:12 PM Jake Hyde @.***> wrote:

@sarahhenkens https://github.com/sarahhenkens Please let me know if you are still encountering this issue, otherwise I will be closing it. @rmammadli https://github.com/rmammadli Glad to hear you are no longer affected. I do think it was related to the changes around dynamic schemas which have since been fixed.

β€” Reply to this email directly, view it on GitHub https://github.com/rancher/rancher/issues/41552#issuecomment-1709124631, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABDL5U2RX3JBUSFVFTFPWTXZDRKJANCNFSM6AAAAAAYAFLMKY . You are receiving this because you were mentioned.Message ID: @.***>

@jakefhyde thank you for taking the time to look into this issue.

I am not observing the same issue on rancher v2.7.[4-6]