What is the kube_config_cluster.yml file that is created after provisioning a cluster with the Rancher Kubernetes Engine (RKE) CLI?
This document (000020139) is provided subject to the disclaimer at the end of this document.
Situation
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"
Further Reading
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.