Question
The Rancher Kubernetes Engine (RKE) documentation references a file kube_config_cluster.yml
that is generated after running rke up
, this article explains what this file is and how to use it.
Pre-requisites
- A Rancher Kubernetes Engine (RKE) CLI provisioned Kubernetes cluster
- kubectl installed
Answer
When you provision a Kubernetes cluster using RKE, a kubeconfig file is automatically generated for your cluster.
This file is created and saved as kube_config_<cluster>.yml
, where <cluster>
is the filename of your cluster configuration YAML file. This kubeconfig defines the connection and authentication details to interact with your cluster, using tools such as kubectl
.
By default, kubectl checks ~/.kube/config
for a kubeconfig file, but you can specify a different kubeconfig file using the --kubeconfig flag. For example:
kubectl --kubeconfig /custom/path/rke/kube_config_cluster.yml get pods
Or you can export the config path into the KUBECONFIG environment variable, removing the requirement to specify the --kubeconfig flag each time you run kubectl:
export KUBECONFIG="/custom/path/rke/kube_config_cluster.yml"
Comments
Please sign in to leave a comment.