Create managed Kubernetes Secrets from mapping files and your credentials repos
1.2K
Create managed Kubernetes Secrets from mapping files and your credentials repos
At Tumblr, we wanted a way to allow applications to declare their dependencies on secrets (passwords, certificates, etc) without needing to create configurations that are aware of specific secret files. A system like this will allow automation to ensure applications always have the appropriate secrets at runtime, while enabling automated systems (cert refreshers, DB password rotations, etc) to automatically manage and update these credentials, and not require the application to redeploy/restart. Additionally, we wanted a system to limit the scope and access of any application to the minimum set of credentials necessary to run, minimizing a compromise blast radius.
To solve this problem, we created a system to enable developers to declare their application's secret dependencies, without needing access to the secret files in our secure credential stores. The k8s-secret-projector is a tool that:
ProjectionManifest YAMLs (typically in a separate git repo)Secret manifests by processing ProjectionManifest along with your credential reposIt is meant to operate in a larger system of CI/CD in your organization. The following diagram explains a typical setup:
+------------------------+
| | +---------------------------------------------+
| Secret Manifests Repo | | |
| (projection manifests) | | Typical Workflow for k8s-secret-projector |
| | | use in CI/CD pipelines |
+-----+------------------+ | |
| +---------------------------------------------+
| Webhook/similar to trigger
| CI/CD jobs on merge to master +------------------+
| | |
| | Credentials Repo |
| +----------------------+ +-------------------+ | (staging) |
+-----v----------------+ | | | +---------------> |
| | | k8s-secret-projector | | Check out | +-------------+----+
| Jenkins/Travis CI/CD +-------------> docker image +-----------------> Credentials Repos +---------+ |
| | | | | | | |
+----------------------+ +----------------------+ +--------+----------+ +----v-------------+ |
| | | |
Job runs in container, | | Credentials Repo | |
sets up workspace | | (production) | |
| | | |
| +----------+-------+ |
| | |
| +------------------+ | |
| | | | |
+----> Credentials Repo | | |
| (development) | | |
| | | |
+----------------+-+ | |
| | |
| | |
| | |
+-----------------------+ +----------------------------------+ | | |
| | | <--+ | |
| Use kubectl to deploy <---------------+ Run k8s-secret-projector <-------+ |
| generated secrets | | (generate secret YAML resources) <---------------------+
| | | |
+-----------------------+ +------------------^---------------+
|
|
| This should be the commit that
| triggered the CI job in Jenkins
|
|
+------------+-----------+
| |
| Secret Manifests Repo |
| (projection manifests) |
| |
+------------------------+
JSONPath notationjsonpath notationSee docs at docs/!
Builds are performed by Travis and Docker Hub. If you want to build this yourself, see below.
$ GOOS=linux GOARCH=amd64 make
$ file bin/k8s-secret-projector
bin/k8s-forward-zone-generator: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
Docker images are built and pushed to the Hub automatically.
If you want to build this yourself, locally:
$ make docker
...
Successfully built 8ce7a5f5542c
Successfully tagged tumblr/k8s-secret-projector:v0.1.0-13-g1f564dc
We build plugins for use with the encryption module system. make plugins should do the needful.
The shared objects will be dropped in /*.so. They should be referenced by the ProjectionManifest's Encryption.PluginFile field.
See docs at docs/hacking.md!
See MAINTAINERS.md
Copyright 2019, Tumblr, Inc.
Content type
Image
Digest
Size
33.9 MB
Last updated
over 7 years ago
docker pull tumblr/k8s-secret-projector