Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the Mozilla SOPS decryption with HashiCorp Vault section #713

Merged
merged 1 commit into from
Feb 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 2 additions & 51 deletions content/en/docs/guides/mozilla-sops.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,58 +191,9 @@ Encrypting with age follows the same workflow than PGP. See the [Kustomization-c

## Encrypting secrets using HashiCorp Vault

Sops needs a valid Vault token in an environment variable named `VAULT_TOKEN` to decrypt the secrets.
[HashiCorp Vault](https://www.vaultproject.io/docs/what-is-vault) is an identity-based secrets and encryption management system.

Create a Kubernetes secret named `sops-vault-token` in the `flux-system` namespace:

```sh
kubectl create secret generic sops-vault-token \
--namespace=flux-system \
--from-literal=token=$VAULT_TOKEN
```

[Customize your Flux Manifests](../installation/_index.md#customize-flux-manifests) so that kustomize-controller has the proper credentials.
Patch the kustomize-controller Pod template so that the `VAULT_TOKEN` environment variable is set:

`clusters/cluster0/flux-system/kustomization.yaml`
```yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- gotk-components.yaml
- gotk-sync.yaml
patches:
- path: sops-kustomize-patch.yaml
target:
kind: Deployment
```

`clusters/cluster0/flux-system/sops-kustomize-patch.yaml`
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: kustomize-controller
namespace: flux-system
spec:
template:
spec:
containers:
- name: manager
env:
- name: VAULT_TOKEN
valueFrom:
secretKeyRef:
name: sops-vault-token
key: token
```

At this point, kustomize-controller is now authorized to decrypt values in
SOPS encrypted files from your Sources via the related Vault instance.

See Mozilla's guide to
[Encrypting using Hashicorp Vault](https://github.com/mozilla/sops#encrypting-using-hashicorp-vault)
to get started committing encrypted files to your Git Repository or other Sources.
Encrypting with HashiCorp Vault follows the same workflow as PGP & Age. See the [kustomization-controller API doc](/docs/components/kustomize/kustomization/#hashicorp-vault) for more details.

## Encrypting secrets using various cloud providers

Expand Down