How Do I Retrieve and Save My kubeconfig.yaml With the Linode-CLI?
I am trying to save my LKE cluster's kubeconfig as a file while using the Linode-CLI. How can I do this?
✓ Best Answer
The Linode-CLI returns the Base64-encoded Kubeconfig file for a Kubernetes cluster with the following command.
linode-cli lke kubeconfig-view $clusterID
We can decode it and save it to a file with the following one-liner:
linode-cli lke kubeconfig-view $clusterID --text | sed 1d | base64 --decode > $kubeconfig.yaml
To break down what's happening here:
# retrieve the output in a text format linode-cli lke kubeconfig-view $clusterID --text # remove the unneeded "kubeconfig" line sed 1d # decode base64 --decode # redirect output into a file > kubeconfig.yaml