secrets with kubeseal


on the new cluster the state of the cluster is a gitlab project. this includes secrets, just encrypted


the tool

the new cluster has a specific controller on a specific namespace that holds a private key

we use the cli kubeseal which then given a yaml/json format kubectl secrets sends it to that controller, encrypts the fields and returns a yaml or json of a SealedSecret.

This then gets committed and referenced in the deploy jsonnet, the cluster then exports the jsonnet with tanka, applies it and then the cluster decrypts and creates a regular secret.

How to

  1. have kubeconfig pointing to the correct cluster on which the controller you are targetting is on
  2. cat path/to/secrets.yaml | kubeseal --controller-namespace sealed-secrets --controller-name sealed-secrets > your_sealed_secret.json

    1. take the content of the secret
    2. pipes it to kubeseal
    3. sends it to the sealed secrets controller on the cluster
    4. writes the retunred sealed secrets into your_sealed_secret.json
  3. put the resulting file in a folder called sealed-secrets (customary not necessary naming)
  4. add it in the deploy function