How safe is running doctl inside a kubernetes container?

tl;dr: Is it safe to have a doctl access token in a secret inside kubernetes? What is a good alternative?

I have my domain with mrdomain, I can’t change the dns to use digital ocean’s because to keep using the email from mrdomain they need to manage the domain. I want to use the spaces with CDN and i’m using lets encrypt to generate SSL certs once every 2 months.

I’ve written a container to be run on a CronJob that:

  • Generates an SSL cert manually;
  • Uploads to the space;
  • Validates the cert;
  • Creates the cert on my account;
  • Assign the cert to the corresponding space;
  • Removes the old invalid cert

It works fine, but I need to run doctl compute certificate create, doctl compute cdn update and doctl compute certificate delete. Those 3 commands need a token with write permission.

If anyone get access to this token they will have unlimited access to wreak havoc on our account.

So my question is, is it safe to keep this under a kubernetes secret? Is there a better option?

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.

Bobby Iliev
Site Moderator
Site Moderator badge
January 9, 2023

Hey @nicoskaralis,

I believe that the approach that you’ve taken with a separate cronjob container, the solution should be sufficient. In the long run, it looks like someone has had the same idea before and has posted it on our Product Ideas board. The best thing to do would be to head over and add your vote to it, as well as adding any additional information in the comments for exactly what you’d like to see implemented!


- Bobby.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.