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

Automatic Hashicorp Vault Agent installation, configuration and Kubernetes - Hashicorp Vault integration #1191

Closed
erzetpe opened this issue Apr 23, 2020 · 0 comments · Fixed by #1353 or #1393

Comments

@erzetpe
Copy link
Contributor

erzetpe commented Apr 23, 2020

This is integration of Hashicorp Vault with Kubernetes according to design doc: This is installation of Hashicorp Vault, to provide Vault according to design doc: https://github.com/epiphany-platform/epiphany/blob/develop/docs/design-docs/k8s-vault-integration/k8s-vault-integration.md

Test scenario:

  1. Build new cluster from scratch
  2. Login to Vault using root token from /opt/vault/init.txt:
vault login
  1. Add secret to path secret/devwebapp/config:
vault kv put secret/devwebapp/config username='giraffe' password='salsa'
  1. Apply test deployment created base on busybox:
apiVersion: apps/v1
kind: Deployment
metadata:
  name: devwebapp
  labels:
    app: devwebapp
spec:
  replicas: 1
  selector:
    matchLabels:
      app: devwebapp
  template:
    metadata:
      labels:
        app: devwebapp
      annotations:
        vault.hashicorp.com/agent-inject: "true"
        vault.hashicorp.com/role: "devweb-app"
        vault.hashicorp.com/agent-inject-secret-credentials.txt: "secret/data/devwebapp/config"
        vault.hashicorp.com/tls-skip-verify: "true"
    spec:
      serviceAccountName: internal-app
      containers:
      - name: app
        image: busybox
        command:
        - sleep
        - "3600"
        imagePullPolicy: IfNotPresent
  1. Check if init container has finished it's work with command:
kubectl logs -f $(kubectl get pods | grep devwebapp | awk '{ print $1 }') -c vault-agent-init

and look for output similar to the one below:

2020/06/25 09:24:49.417623 [INFO] (runner) rendered "(dynamic)" => "/vault/secrets/credentials.txt"
2020/06/25 09:24:49.417657 [INFO] (runner) stopping
2020-06-25T09:24:49.417Z [INFO]  template.server: template server stopped
2020/06/25 09:24:49.417729 [INFO] (runner) received finish
  1. Check existence of file /vault/secrets/credentials.txt in container with command:
kubectl exec -ti $(kubectl get pods | grep devwebapp | awk '{ print $1 }') -c app -- cat /vault/secrets/credentials.txt
@erzetpe erzetpe added this to the Hashicorp Vault milestone Apr 23, 2020
@toszo toszo added the size/S label Apr 30, 2020
@toszo toszo added size/XS and removed size/S labels May 7, 2020
@erzetpe erzetpe self-assigned this May 20, 2020
@erzetpe erzetpe linked a pull request Jun 9, 2020 that will close this issue
@erzetpe erzetpe linked a pull request Jun 22, 2020 that will close this issue
@erzetpe erzetpe reopened this Jun 29, 2020
@erzetpe erzetpe linked a pull request Jun 29, 2020 that will close this issue
@toszo toszo closed this as completed Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment