Cluster Access
The kubeconfig file stored at /etc/rancher/rke2/rke2.yaml
is used to configure access to the Kubernetes cluster. If you have installed upstream Kubernetes command line tools such as kubectl or helm you will need to configure them with the correct kubeconfig path. This can be done by either exporting the KUBECONFIG
environment variable or by invoking the --kubeconfig
command line flag. Refer to the examples below for details.
Some tools, such as kubectl, are installed by default into |
Leverage the KUBECONFIG environment variable:
export KUBECONFIG=/etc/rancher/rke2/rke2.yaml
kubectl get pods --all-namespaces
helm ls --all-namespaces
Or specify the location of the kubeconfig file in the command:
kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml get pods --all-namespaces
helm --kubeconfig /etc/rancher/rke2/rke2.yaml ls --all-namespaces