Docker image to print env variables, to allow testing of vaultenv setup
727
Vaultenv-test was created as a proof of concept in getting Vault secrets into Kubernetes deployments using the new Vault Kubernetes backend.
No init-containers or sidecar injection are required; provided the Docker image you wish to run has the vaultenv binary, it can work.
With Vault 0.8.3, vault auth-enable kubernetes will enable the Kubernetes backend if not done so already. You'll also need to set Vault to connect to Kubernetes API with vault write auth/kubernetes/config; check the Vault documentation for how that is configured.
You'll need to create a Vault role (my-app) which binds an existing Vault policy (do-a-lot) against the service account (my-app-service-account) in the namespace of your deployment (default):
vault write auth/kubernetes/role/my-app
bound_service_account_names=my-app-service-account \
bound_service_account_namespaces=default \
policies=do-a-lot \
ttl=48h
For the purpose of this proof of concept, I created a test secret with
vault write secret/helm-app/mytribe-sandbox/myapp \
myappisworking=yesitsworking
With Vault configured, I can deploy the Kubernetes yaml files included in /kubernetes-example
my-app-service-account referenced in Vault, and give it auth-delegator accessA number of variables here might need to change for different deployments:
serviceAccountName matches the service account created by rbac.yamlJSON_WEB_TOKEN should get a valid JWTVAULT_TOKEN uses jq, and calls for the Vault role defined earlier (my-app in this case)secrets-fileno-connect-tls is in place because it was a dev Vault; production Vault will need to be over HTTPS./usr/bin/printenv is used as the application called by vaultenv; in reality the entrypoint of the Docker image should be here insteadWhen the deployment is made, the logs should show the curl commands and the content of printenv. If the secret is found, ISWORKING=yesitsworking should appear in the output.
Content type
Image
Digest
Size
81.6 MB
Last updated
almost 9 years ago
docker pull grrywlsn/vaultenv-test