HashiCorp Vault with Yandex KMS support
HashiCorp Vault is an open source tool for securely storing and accessing secrets (for example, passwords, certificates, and tokens). The image contains a pre-installed build of HashiCorp Vault with added support for Auto Unseal via Yandex Key Management Service. The build is based on HashiCorp Vault 2.0.3.
- Create a service account, which is required for HashiCorp Vault:
yc iam service-account create --name vault-kms
- Create an authorized key for the service account and save it to the file
authorized-key.json:
yc iam key create \
--service-account-name vault-kms \
--output authorized-key.json
- Create a Yandex Key Management Service key:
yc kms symmetric-key create \
--name example-key \
--default-algorithm aes-256 \
--rotation-period 24h
Save the key ID (id). You will need it when installing the application.
- Assign the service account the
kms.keys.encrypterDecrypterrole for the Yandex Key Management Service key:
yc kms symmetric-key add-access-binding \
--name example-key \
--service-account-name vault-kms \
--role kms.keys.encrypterDecrypter
- Configure the application:
- Namespace: Create a new namespace, e.g.,
hashicorp-vault-space. If you leave the default namespace, HashiCorp Vault may work incorrectly. - Application name: Enter an application name.
- Service account key: Copy the contents of the
authorized-key.jsonfile to this field. - KMS key ID: Specify the ID of the Yandex Key Management Service key that you got earlier.
-
Click Install.
-
Make sure that the application switched to
Runningand has0/1ready pods:
kubectl get pods --selector='app.kubernetes.io/name=vault'
Expected output:
NAME READY STATUS RESTARTS AGE
<vault pod name> 0/1 Running 0 58s
- Initialize the vault:
kubectl exec --stdin=true --tty=true <vault pod name> -- vault operator init
Expected output:
Recovery Key 1: ulbugw4IKttmCCPprF6JwmUCyx1YfieCQPQiI2S0VV9o
Recovery Key 2: S0kcValC6qSfEI4WJBovSbJWZntBUwtTrtisSIcS3n0e
Recovery Key 3: t44ZRqbzLZNzfChinZNzLCNnwvFN/R52vbDq/UueHPPg
Recovery Key 4: af4PRlm3VdXRzEHoDpYEnSgbwj4oc4zLCwkJG36cOUER
Recovery Key 5: rw9LXcyGEhoO4y4O5IA32IwiDS2t76zd52eiVqfpu+b6
Initial Root Token: s.4ddyD9kkIKVrslVBQBX1I5Pq
Success! Vault is initialized
Recovery key initialized with 5 key shares and a key threshold of 3. Please
securely distribute the key shares printed above.
Don’t run the unseal operation when initializing the vault. For more information, see Auto Unseal and the HashiCorp Vault documentation.
- Query the list of application pods again and make sure that one pod is ready:
kubectl get pods --selector='app.kubernetes.io/name=vault'
Expected output:
NAME READY STATUS RESTARTS AGE
vault-yckms-k8s-0 1/1 Running 0 1h
Yandex Cloud technical support is available 24/7. The types of requests you can submit and the appropriate response time depend on your pricing plan. You can switch to the paid support plan in the management console. You can learn more about the technical support terms here. You can also get help from the community.
| Helm chart | Version | Pull-command | Documentation |
|---|---|---|---|
| yandex-cloud/vault-yckms-k8s/charts/vault | 0.34.0-yckms | Open |
| Docker image | Version | Pull-command |
|---|---|---|
| yandex-cloud/vault-yckms-k8s/vault-k8s1784728221387477167381836090340356766972017947690 | 1.7.5 | |
| yandex-cloud/vault-yckms-k8s/vault1784728221387477167381836090340356766972017947690 | 2.0.3_yckms | |
| yandex-cloud/vault-yckms-k8s/vault1784728221387477167381836090340356766972017947690 | 2.0.3_yckms | |
| yandex-cloud/vault-yckms-k8s/vault-csi-provider1784728221387477167381836090340356766972017947690 | 1.7.3 |