linode-cli icon indicating copy to clipboard operation
linode-cli copied to clipboard

Output of linode-cli lke kubeconfig-view is not a yaml.

Open dppattison opened this issue 4 years ago • 5 comments

To reproduce: Create example lke cluster with linode-cli: linode-cli lke cluster-create --label kubtest --region us-central --k8s_version 1.21 --node_pools.type g6-standard-1 --node_pools.count 3 Wait until all is provisioned and running. Find cluster id: linode-cli lke clusters-list Get kubeconfig: linode-cli lke kubeconfig-view <cluster ID>

Appears encrypted, but there is minimal documentation on this. Downloading from dashboard works as expected.

dppattison avatar Jun 18 '21 16:06 dppattison

The docs say that this operation returns a base64-encoded kubeconfig - you should be able to retrieve the yaml by decoding the output blob. You can do that in all one step like this:

linode-cli lke kubeconfig-view $LKE_CLUSTER_ID --text  --no-headers | base64 -d

I do agree that it would be nice if this operation returned the YAML without needing manual decoding, though; I'll look into it. Thanks for the report 👍

Dorthu avatar Jun 21 '21 11:06 Dorthu

So I did some tinkering with this, and while I can get it to work, the output looks rather bad in most terminals, as the long token and certifiacte-authority-data fields exceed the size of every terminal I've tried it in. Using --text for output looks a lot better. I'm going to post a PR for discussion, which I will link to this issue.

Dorthu avatar Jun 21 '21 12:06 Dorthu

Perhaps a more accurate issue report would be regarding the feedback of --help in this case:

finn@ws:~$ linode-cli lke kubeconfig-view --help

linode-cli lke kubeconfig-view [CLUSTERID]

Kubeconfig View

As opposed to docs, which provide the adequate: "The Base64-encoded Kubeconfig file for this Cluster."

dppattison avatar Jun 21 '21 13:06 dppattison

A couple general notes on documentation from an outsider: There are likely two entry points for information-gathering when someone is looking to automate linode admin.

  1. The repo README is likely the landing page for anyone starting to write scripts for linode automation. There is no link from the readme to documentation.
  2. The developer docs landing page https://developers.linode.com/ -- which has a section for "API documentation" but makes no mention of this being shared API/CLI documentation.

It's also entirely possible I just swung and missed this time in my search engine queries.

dppattison avatar Jun 21 '21 13:06 dppattison

On further investigation, I'll chalk this one up to poor performance of search engines. Actually navigating from linode.com instead of googling yields the page https://www.linode.com/products/cli/ -- which explicitly states that the API/CLI documentation is shared. Thanks for the tip, though.

dppattison avatar Jun 21 '21 13:06 dppattison