https://github.com/techiescamp/kubernetes-vault
Kubernetes manifests to setup Hashicorp vault server
https://github.com/techiescamp/kubernetes-vault
Last synced: about 1 year ago
JSON representation
Kubernetes manifests to setup Hashicorp vault server
- Host: GitHub
- URL: https://github.com/techiescamp/kubernetes-vault
- Owner: techiescamp
- Created: 2021-05-30T09:19:10.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-28T13:50:58.000Z (over 1 year ago)
- Last Synced: 2025-04-19T20:53:47.576Z (over 1 year ago)
- Language: Shell
- Size: 25.4 KB
- Stars: 21
- Watchers: 3
- Forks: 30
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# kubernetes-vault
Kubernetes manifests to setup Hashicorp vault server
Full Documentation: https://devopscube.com/vault-in-kubernetes/
#Sample API request to the vault using service account tokens to acquire a token with reading capabilities for path "demo-app"
```
curl --request POST --data '{"jwt": "<< service account token of the pod >>", "role": "webapp"}' http://192.168.49.2:30493/v1/auth/kubernetes/login
```
#Sample API request to the vault to fetch secrets at "demo-app"
```
curl -H "X-Vault-Token: " -H "X-Vault-Namespace: vault" -X GET http://192.168.49.2:30493/v1/demo-app/data/user01?version=1
```
## Vault Usage
### Initialize the vault.
```kubectl exec vault-0 -- vault operator init -key-shares=1 -key-threshold=1 -format=json > keys.json
VAULT_UNSEAL_KEY=$(cat keys.json | jq -r ".unseal_keys_b64[]")
echo $VAULT_UNSEAL_KEY
VAULT_ROOT_KEY=$(cat keys.json | jq -r ".root_token")
echo $VAULT_ROOT_KEY
```
### Unseal the vault
```kubectl exec vault-0 -- vault operator unseal $VAULT_UNSEAL_KEY ```
### Login into the vault
```kubectl exec vault-0 -- vault login $VAULT_ROOT_KEY```
### Create secrets
```vault secrets enable -version=2 -path="demo-app" kv```
### Create key-value pairs
```vault kv put demo-app/user01 name=devopscube
vault kv get demo-app/user01
```
###Create policies
```vault policy write demo-policy - <