hashicorp-vault Plugin

    This plugin installs hashicorp-vault with replicas:3 by default value.

    Initialize all the Vault pods

    At first, you must install tool: jq is a lightweight and flexible command-line JSON processor. Download jq

    1. Initialize vault-0
    1. # Initialize vault-0 with one key share and one key threshold.
    2. kubectl exec vault-0 -n $NAMESPACE -- vault operator init -key-shares=1 -key-threshold=1 -format=json > cluster-keys.json
    1. Display the unseal key
    1. # Display the unseal key found in cluster-keys.json
    2. cat cluster-keys.json | jq -r ".unseal_keys_b64[]"
    1. Create a variable to capture the Vault unseal key
    1. Unseal vault-0
    1. # Unseal vault-0 running on the vault-0 pod.

    You will see the above command’s output like this. Make sure the value of Initialized is ‘true’ and the value of Sealed is ‘false’.

    1. Key Value
    2. --- -----
    3. Initialized true
    4. Sealed false
    5. Total Shares 1
    6. Threshold 1
    7. Version 1.9.2
    8. Storage Type raft
    9. Cluster Name vault-cluster-14052440
    10. Cluster ID 7630cd33-2ee1-39c1-db3f-e48a6d79970a
    11. HA Enabled true
    12. HA Cluster https://vault-0.vault-internal:8201
    13. Active Since 2022-04-23T16:45:47.6060163Z
    14. Raft Committed Index 30
    15. Raft Applied Index 30
    1. Initialize vault-1 and vault-2 like vault-0
    1. Verify all the pods status
    1. # Verify all the Vault pods are running and ready.
    2. kubectl get pods -n $NAMESPACE
    1. NAME READY STATUS RESTARTS AGE
    2. vault-0 1/1 Running 0 2m29s
    3. vault-1 1/1 Running 0 2m29s
    4. vault-2 1/1 Running 0 2m29s
    5. vault-agent-injector-68dc986-bnsj2 1/1 Running 0 2m28s
    1. After the above operations, you want to use the Vault to write/read secrets. You need to follow the documentation of the hashicorp Vault: