docs

Secrets with Infisical

Your secrets live in Infisical, in your cluster. External Secrets copies them into Kubernetes Secrets for your apps. They never go through Git.

INFISICALYour secretsproject + environmentMachine identityits login, read-onlyIN NAMESPACE <app><app>-secreta Kubernetes SecretYour appreads it as env varsExternal SecretsVIA THE STOREinfisical

INFISICAL

  • Your secretsproject + environment
  • Machine identityits login, read-only

External Secrets logs in and reads them

External Secrets

VIA THE STORE

  • infisical

It writes a Secret that your app reads

  • <app>-secreta Kubernetes Secret
  • Your appreads it as env vars
External Secrets refreshes the Secret on a schedule: every hour in the example app.

Why

A password in a values file ends up in Git history, and in every clone of your repo. Here, your repo only holds the name of a secret. The value stays in Infisical, and only the cluster reads it.

Ready after the install

The installer sets up Infisical and connects it to External Secrets: a project for your secrets, a read-only login for External Secrets, and the store your apps point at. There is nothing to configure.

All you do is add your secrets in the Infisical web app, at https://infisical.<domain>.

Use a secret in your app

  1. Add it in Infisical

    In the Infisical web app, add your secret to the project. For example, DB_PASSWORD.

  2. Declare it in your app

    In your app's values.yaml, the externalSecret block lists the secrets to copy:

    app-template:
      externalSecret:
        secret:
          enabled: true
          refreshInterval: 1h
          secretStoreRef:
            name: infisical
            kind: ClusterSecretStore
          data:
            - secretKey: db-password   # key in the Secret
              remoteRef:
                key: DB_PASSWORD       # name in Infisical

    External Secrets writes them into the Secret <app>-secret, which your container reads as env vars. The backend example in your fork, examples/app-template/backend, shows the whole app.

  3. Push

    ArgoCD deploys the app and External Secrets fills its Secret. A changed value reaches the Secret within refreshInterval. To restart your pods when it does, add the Reloader annotation reloader.stakater.com/auto: "true" to the app's controller.

Good to know

  • Keep the encryption keyInfisical encrypts your secrets with a key generated in the cluster at install. Keep a copy outside the cluster, in a password manager: without it, a restored database cannot be decrypted.
  • One store for the whole clusterAny app, in any namespace, can read every secret in the project.
  • Database passwords are not in InfisicalThe cnpg-cluster chart generates them in the cluster. See Databases.