# GitOps, K8s, Doppler & Disaster recovery

**URL:** <https://community.doppler.com/t/gitops-k8s-doppler-disaster-recovery/703>\
**Category:** Discussions\
**Created:** [July 27, 2022, 1:38am UTC](https://community.doppler.com/t/gitops-k8s-doppler-disaster-recovery/703 "2022-07-27T01:38:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francois](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/francois/32/951_2.png) [@Francois](https://community.doppler.com/u/Francois)\
**Post date:** [July 27, 2022, 1:38am UTC](https://community.doppler.com/t/gitops-k8s-doppler-disaster-recovery/703/1 "2022-07-27T01:38:45Z")

</div>

Hello there,

Open discussion about how Doppler could fit and improve my existing setup.

Currently, 1 Kubernetes cluster has between 10 and 15 micro-services (1 per namespace).  
In the cluster, Sealed secret operator is installed. Each project deployment has secrets encrypted using the SealedSecret key. Updating a secret means using the key, creating a secret, converting it to a SealedSecret CRD, deleting the original secret etc. Quite long and annoying to update values for anyone.

Now, Doppler could be useful because any devs/ops would just have to update the value in [doppler.com](http://doppler.com) to see it reflects on the application running (instead of encrypting it manually, commit and pushing to a repo).

With doppler, it requires a token scoped to a project/env to then create K8s secrets with the correct values.  
How can I automatize these secrets creation? To avoid running `doppler setup` choosing the right project/env, and then running `kubectl create secret generic doppler-token-secret --namespace doppler-operator-system --from-literal=serviceToken=$(doppler configs tokens create doppler-kubernetes-operator --plain)` for each micro-service.  
I am starting to think about keeping SealedSecret to encrypt the doppler auth tokens… But it seems counter-productive.

I am looking for the closest possible to IaC workflow, in order to automatise cluster creation, moving an app to a different cluster or recreating as fast as possible a cluster in case of disaster.

Let me know what you think about it,  
Best

---

<div class="post-metadata">

**Author:** ![watsonian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/watsonian/32/267_2.png) [@watsonian](https://community.doppler.com/u/watsonian)\
**Post date:** [July 27, 2022, 5:03pm UTC](https://community.doppler.com/t/gitops-k8s-doppler-disaster-recovery/703/2 "2022-07-27T17:03:23Z")

</div>

Hi @Francois,

Welcome to the Doppler Community!

You can pass in `--project` and `--config` to the command you’re using there to generate the token like this:

```nohighlight
kubectl create secret generic doppler-token-secret-service-foo --namespace 
doppler-operator-system --from-literal=serviceToken=$(doppler configs 
tokens create --project foo --config prd doppler-kubernetes-operator --plain)

```

That would let you generate the tokens you need. If you happen to be using Terraform, then you can use [this resource](https://registry.terraform.io/providers/DopplerHQ/doppler/latest/docs/resources/service_token) to generate service tokens as well.

Does that help? Let me know if you have any other questions!

Regards,  
-Joel

---

<div class="post-metadata">

**Author:** ![Francois](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/francois/32/951_2.png) [@Francois](https://community.doppler.com/u/Francois)\
**Post date:** [July 28, 2022, 9:26am UTC](https://community.doppler.com/t/gitops-k8s-doppler-disaster-recovery/703/3 "2022-07-28T09:26:59Z")

</div>

Hello @watsonian,  
Thanks for your answer!

That’s nice, so I can automate it a bit more 😃

When is it best to generate such token when you deploy a new project?

Before the deployment in a pipeline you make sure the secret exists, otherwise, generate it?

And how can it be integrated into a GitOps workflow? With ArgoCD or FluxCD?

Hope it is not too many questions haha ^^

Regards,

---

<div class="post-metadata">

**Author:** ![watsonian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/watsonian/32/267_2.png) [@watsonian](https://community.doppler.com/u/watsonian)\
**Post date:** [July 28, 2022, 4:37pm UTC](https://community.doppler.com/t/gitops-k8s-doppler-disaster-recovery/703/4 "2022-07-28T16:37:47Z")

</div>

Hi @Francois,

Honestly, that depends a lot on your particular setup and workflow. If you manage things through Terraform, then that’s an obvious place where you can generate tokens (and it will take care of generating if the token doesn’t exist already). If you’re not using Terraform, then you could certainly automate it through some kind of CI/CD workflow that reads some kind document (e.g., JSON/YAML) that describes your Doppler environment and then updates Doppler accordingly via the API (or by running Terraform, for example).

If you aren’t already, I’d probably recommend using Terraform for this since it’s designed to do pretty much exactly what you’re looking for. You can either automate runs in a CI/CD system or use their [Terraform Cloud](https://cloud.hashicorp.com/products/terraform) service.

Does that help at all?

---

<div class="post-metadata">

**Author:** ![Francois](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/francois/32/951_2.png) [@Francois](https://community.doppler.com/u/Francois)\
**Post date:** [July 29, 2022, 7:24am UTC](https://community.doppler.com/t/gitops-k8s-doppler-disaster-recovery/703/5 "2022-07-29T07:24:42Z")

</div>

It helps a lot! Thanks for your comments 🙂
