Skip to content

How to Connect to Rancher Provisioned Clusters using CLI When Rancher is Offline

Article Number: 000021767

Environment

Rancher Version : Applicable for all Rancher versions.

Downstream clusters : RKE1 , RKE2 or K3S

Standalone Clusters : Its applicable for Standalone clusters of RKE1 , RKE2 or K3S

SSH access to the ControlPlane nodes are mandatory.

Situation

In the event of a Rancher application outage, administrators may need to directly access provisioned downstream clusters via command-line interface (CLI) tools to diagnose and resolve issues.

Cause

NA

Resolution

RKE2 :

  • SSH to the Server Node ( Privileged access is required )
  • Run the Below Command
# export CRI_CONFIG_FILE=/var/lib/rancher/rke2/agent/etc/crictl.yaml KUBECONFIG=/etc/rancher/rke2/rke2.yaml
# PATH=$PATH:/var/lib/rancher/rke2/bin
  • To verify, check the "crictl" and "kubectl" access to the cluster from the Server node.

K3S :

  • SSH to the Server Node ( Privileged access is required )
  • Run the Below Command
# export CRI_CONFIG_FILE=/var/lib/rancher/k3s/agent/etc/crictl.yaml KUBECONFIG=/etc/rancher/k3s/k3s.yaml
# PATH=$PATH:/var/lib/rancher/k3s/agent/containerd/bin/ 
  • To verify, check the "crictl" and "kubectl" access to the cluster from the Server node.

RKE1 : 

  • SSH to the Server Node ( Privileged access is required )
  • Follow the GH article to retrieve kubeconfig file
  • To verify, check the "docker" and "kubectl" access to the cluster from the Server node.