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

Error: Unable to use supplied token to access API: GET 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

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.


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