Skip to content

Instantly share code, notes, and snippets.

@developer-guy
Created March 29, 2021 10:30
Show Gist options
  • Save developer-guy/eb25cc71db2fd756fd10dff58fdfcaa8 to your computer and use it in GitHub Desktop.
Save developer-guy/eb25cc71db2fd756fd10dff58fdfcaa8 to your computer and use it in GitHub Desktop.
Vault proper setup test
# Set the Vault token from the Kubernetes secret
# (strictly for demonstrative purposes, we have K8s unsealing in cr.yaml)
$ export VAULT_TOKEN=$(kubectl get secrets vault-unseal-keys -o jsonpath={.data.vault-root} | base64 --decode)
# Tell the CLI that the Vault Cert is signed by a custom CA
$ kubectl get secret vault-tls -o jsonpath="{.data.ca\.crt}" | base64 --decode > $PWD/vault-ca.crt
$ export VAULT_CACERT=$PWD/vault-ca.crt
# Tell the CLI where Vault is listening (the certificate has 127.0.0.1 as well as alternate names)
$ export VAULT_ADDR=https://127.0.0.1:8200
# Forward the TCP connection from your Vault pod to localhost (in the background)
$ kubectl port-forward service/vault 8200 &
# Get all the enabled Secret Engines
$ vault secrets list
Path Type Accessor Description
---- ---- -------- -----------
cubbyhole/ cubbyhole cubbyhole_67591e13 per-token private secret storage
identity/ identity identity_b2faf21a identity store
pki/ pki pki_7e3b8a1d Vault PKI Backend
secret/ kv kv_a59a3e59 General secrets. <-- important for us
sys/ system system_9a3b8cf0 system endpoints used for control, policy and debugging
# Get all the enabled Auth Methods
$ vault auth list
Path Type Accessor Description
---- ---- -------- -----------
kubernetes/ kubernetes auth_kubernetes_350ba5a2 kubernetes backend <-- important for us
token/ token auth_token_72b96311 token based credentials
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment