#!/usr/bin/env bash set -euo pipefail # Following: https://developer.hashicorp.com/vault/tutorials/kubernetes/vault-secrets-operator # Install vault helm repo add hashicorp https://helm.releases.hashicorp.com helm repo update helm search repo hashicorp/vault helm install vault hashicorp/vault \ -n vault \ --create-namespace \ --values https://raw.githubusercontent.com/hashicorp-education/learn-vault-secrets-operator/refs/heads/main/vault/vault-values.yaml # Configure vault kubectl exec --stdin=true --tty=true vault-0 -n vault -- /bin/sh ## Within the pod cd tmp vault auth enable -path demo-auth-mount kubernetes vault write auth/demo-auth-mount/config kubernetes_host="https://$KUBERNETES_PORT_443_TCP_ADDR:443" vault secrets enable -path=kvv2 kv-v2 tee webapp.json <