Overview
SOPS (Secrets OPerationS) lets you encrypt structured files—YAML, JSON, and ENV—so they can be safely stored in public Git repos. It integrates with multiple key management systems:For full SOPS documentation, see the Mozilla SOPS GitHub repository.
What Is PGP/GPG?
- PGP: Pretty Good Privacy
- GPG: GNU Privacy Guard (OpenPGP implementation)
Step 1: Generate a GPG Key
Create a 3072-bit RSA key without passphrase or expiration:Step 2: Store the Private Key in Kubernetes
Create a Kubernetes Secret in theflux-system namespace:
Never commit
sops.private.asc to Git. Only sops.pub.asc should be versioned.Step 3: Encrypt a Kubernetes Secret with SOPS
Follow these steps:- Generate a plain Secret manifest:
- Import the public key:
- Encrypt the file (or specific fields):
Encrypted
secret.yaml: - Commit the encrypted
secret.yamlto your Git repository.
Step 4: Decrypt with Flux’s Kustomize Controller
Configure yourKustomization to enable SOPS decryption:
sops-gpg secret to decrypt and apply your secret.yaml inside the cluster.