This guide explains how to enable and use the Key-Value version 2 secrets engine in HashiCorp Vault for securely storing and managing secrets.
In this guide, you’ll learn how to enable and use the Key-Value (KV) version 2 secrets engine in HashiCorp Vault. The KV secrets engine allows you to securely store arbitrary secrets—like database credentials, API keys, or certificates—and manage multiple versions, metadata, and lifecycle operations.
If Vault is running in Kubernetes, exec into the pod to run the same commands:
Copy
Ask AI
kubectl get pods# NAME READY STATUS RESTARTS AGE# vault-0 1/1 Running 0 21mkubectl exec -it vault-0 -- /bin/sh/ # vault secrets enable -path=crds kv-v2/ # vault kv put crds/mysql username=root password=12345/ # vault kv get crds/mysql
After adding secrets, configure authentication methods and attach policies so applications can securely access your KV paths. See Vault Policies for more details.