Secret management

Last modified Apr 20, 2023

This is written the 8 of august 2021

Secret is a Kubernetes object to store a password, a token, or a key. To transfer a secret securely to the cluster Kithosting uses sealed secrets. Sealed secrets are using the public key in an RSA key pair to encrypt the secret. Read more about the encryption here.

How to use sealed secrets

Sealed secrets can be deployed through Argo with Helm chart. If the KIT Service Chart is used you can follow these steps.

Prerequisites

Install kubeseal. This is done by installing sealed secrets local, see the instructions here. The installations steps are dependent on the OS used.

Encrypt and deploy

  1. Encrypt the secret

To encrypt the secret run the following command

echo -n mySecret | kubeseal --raw -n namespace --name secretName --cert certUrl

It is important to set the right namespace and name of the secret, because they are part of the encryption and decryption.

  1. Add the secret to the Helm Chart

The output of the command in step one is used when setting the value of the secret in the Helm chart. An example of the values add to the value-test.yaml is shown below. For more details see the documentation of the service Helm Chart.

sealedSecret:
  secretName:
    encryptedData:
      key: AgBOQOoh7RGqTBPPSG0CtbfZD/Wh+Csl/c5HSqTzy2SoRBxh9n...
  1. Sealed Secret in Argo

When the sealed secret is added to the Helm Chart it will show up in Argo. When the sealed secret is synced, a Kubernetes secret is created from the sealed secret.

alt tekst