Deployment guides

Kubernetes

Give each workload one canary, stored as a Kubernetes Secret next to its real ones. Every pod that loads it carries the same canary, so pods can come and go freely. Even a Secret that no pod loads catches anyone who dumps the cluster's secrets.

kubectl

curl -fsSL https://get.snitchwallet.com | sh -s -- --decoy env:- --name prod-api \
  | kubectl create secret generic payout-signer -n prod --from-env-file=/dev/stdin

Load it into the workload with its other secrets:

spec:
  template:
    spec:
      containers:
        - name: api
          envFrom:
            - secretRef:
                name: payout-signer

Two kinds of intrusion trip it:

  • Someone with a stolen kubeconfig or service-account token lists the cluster's secrets, for example with kubectl get secrets -A -o yaml. This works even if no pod loads the Secret.
  • Someone inside a container reads its environment.

Use one canary per namespace or per workload, named for it, so the alert tells you where to look.

Sealed Secrets

For GitOps, seal the Secret and commit only the sealed file. Keep the -n: a sealed Secret only unseals in the namespace it was sealed for. kubeseal needs to reach the controller, or pass --cert with its public certificate to work offline.

curl -fsSL https://get.snitchwallet.com | sh -s -- --decoy env:- --name prod-api \
  | kubectl create secret generic payout-signer -n prod --from-env-file=/dev/stdin --dry-run=client -o yaml \
  | kubeseal --format yaml > payout-signer.sealed.yaml

External Secrets Operator

If your Secrets come from a cloud secret manager through the External Secrets Operator, store the canary there as a JSON object of variables:

curl -fsSL https://get.snitchwallet.com | sh -s -- --decoy env:- --name prod-api \
  | jq -Rnc '[inputs | select(length > 0) | capture("^(?<key>[^=]+)=(?<value>.*)$")] | from_entries' \
  | aws secretsmanager create-secret --name prod/payout-signer --secret-string file:///dev/stdin

Then sync every key into a Kubernetes Secret, and load it with envFrom as above:

apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
  name: payout-signer
  namespace: prod
spec:
  refreshInterval: 1h
  secretStoreRef:
    kind: ClusterSecretStore
    name: aws-secrets-manager
  target:
    name: payout-signer
  dataFrom:
    - extract:
        key: prod/payout-signer

The same works with Google Secret Manager, Azure Key Vault or Vault as the backing store: see Google Cloud and Azure and Secret managers for how to store it there.

Helm

Most charts can load an existing Secret through a value such as envFrom, extraEnvFrom or existingSecret. Create the Secret as above, then reference it there. Don't put the decoy in a values file: values end up in git and in the release history.

Nodes

Cluster nodes are usually replaced too often for a canary each. If you run long-lived nodes that you'd log in to and fix, give them a per-machine canary at first boot.