An open API service indexing awesome lists of open source software.

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

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 - <