Question

how to change the token in the yaml file for my Kubernetes

Posted November 20, 2021 119 views
Kubernetes

Error: Unable to use supplied token to access API: GET https://api.digitalocean.com/v2/account: 401 (request “8f4eab16-45bb-49f5-8519-6b20870ca913”) Unable to authenticate you
Admins-MBP-2:~ admin$ doctl auth

I know is because i regenerate my personal api token. Is there a way to update it in the config file which i know i can downlaod

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hello,

With doctl you could do the following:

  • Initialize doctl to use the new token:
doctl auth init
  • List available authentication contexts:
doctl auth list
  • Remove authentication context that you do not need:
doctl auth remove   
  • Switches to the new authentication context:
doctl auth switch   

Then finally you can use the following command to get the new Kubernetes config yaml:

doctl kubernetes cluster kubeconfig save

Hope that this helps.
Best,
Bobby