✓ Solved

How Do I Retrieve and Save My kubeconfig.yaml With the Linode-CLI?

Linode Staff

I am trying to save my LKE cluster's kubeconfig as a file while using the Linode-CLI. How can I do this?

1 Reply

✓ 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

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct