doctl is a command-line interface for the DigitalOcean API.
You can find official documentation following the link.
Installation
Go to Releases Page and download the appropriate archive. Extract the binary file and move to the path
sudo mv doctl /usr/local/bin
You can also use package managers if you prefer. Full documentation is provided on the GitHub page above.
Authenticate
You need to create an access token by following this link. After generating a key run:
doctl auth init
And copy it. If everything goes fine you will see the Validating token: OK message.
Autocomplete
To review doctl bash completion:
doctl completion bash
To enable the configuration, add the following line to your .profile or .bashrc.
source <(doctl completion bash)
Save K8s Config
First list available clusters:
doctl kubernetes cluster list
And then save configuration file by received cluster name:
doctl kubernetes cluster kubeconfig save $CLUSTER_NAME