Vault Auto Unseal automatically decrypts the master key at startup by depending on an external KMS, reducing the operational burden of manual unsealing. On GCP, the gcpckms seal using Cloud KMS is officially supported.
From an Ops perspective, this article focuses on service account (SA) design for GCP KMS Auto Unseal. We organize the exam-relevant points (least privilege, key material handling, Workload Identity recommendation) along with the operational pitfalls around permissions, location mismatches, and log auditing.
Vault's gcpckms seal wraps/unwraps Vault's master key using a Cloud KMS symmetric key (purpose=encryption). At startup, the Vault process calls Cloud KMS Encrypt/Decrypt APIs using the attached SA's ADC (Application Default Credentials). Once decryption succeeds, it can read data from storage (Raft, GCS, etc.).
The key design point is that Auto Unseal only requires KMS Encrypt/Decrypt permissions. Management permissions like KMS key creation, rotation, and policy changes should be separated into a different SA. This way, even if the Vault runtime SA is compromised, the damage to key management is contained.
GCP KMS Auto Unseal call flow (high level)
Auto Unseal requirements are narrow. Always separate the often-confused "Vault runtime SA (for Unseal)" and "KMS management SA (key lifecycle)." Further splitting out the permissions needed for Vault's data storage and audit log destinations clarifies fault isolation and permission boundaries.
Exam note: Do not grant admin roles (Owner/Editor, KMS Admin) to the Unseal SA. The iron rule is to grant roles/cloudkms.cryptoKeyEncrypterDecrypter scoped to the KMS key resource.
| SA Type | Primary Use | Required Roles (Recommended) | Grant Scope |
|---|---|---|---|
| Vault Runtime SA (Unseal) | KMS Encrypt/Decrypt at startup | roles/cloudkms.cryptoKeyEncrypterDecrypter | Target cryptoKey resource only |
| KMS Management SA | Key creation/rotation/policy updates | roles/cloudkms.admin (or a least-privilege combination) | Project or keyring |
| Vault Operations SA (Storage) | GCS/Raft I/O, audit log output | roles/storage.objectAdmin, etc. — minimum required | Target bucket/resource only |
| CI/CD Bootstrap SA | Initial key/ring creation, IAM granting | Temporarily elevated, revoked after execution | Project (time-limited) |
The permission required for Vault's gcpckms seal is the principal role roles/cloudkms.cryptoKeyEncrypterDecrypter, which encapsulates cloudkms.cryptoKeyVersions.useToEncrypt and cloudkms.cryptoKeyVersions.useToDecrypt. Grant it only on the target cryptoKey. Granting it broadly at project or keyring level invites unintended key usage.
When using Workload Identity, grant the above role to the GSA via the KSA→GSA binding. On GCE, attach the target GSA to the instance/template and confirm that unnecessary default Editor roles, etc., are not attached.
GCE: Attach the Vault runtime SA to the instance (or MIG). ADC is supplied via metadata. No key files needed.
GKE Workload Identity: Bind the GSA to the KSA, run the Pod with the KSA, and grant the KMS role to the GSA. Autopilot follows the same flow but does not require directly editing the node SA.
For auditing, continuously log KMS Encrypt/Decrypt calls in Cloud Audit Logs and correlate them with Vault startup times and scale events. Set up SIEM notifications to immediately detect abnormal frequency or off-hours Decrypt activity.
Rotate keys in KMS; Vault can automatically Encrypt/Decrypt with the new version (the Decrypter still works on older versions). Document SLOs for rotation cadence and key lifetimes, and mirror the same permission design at backup/DR sites.
Below is a least-privilege example. The location is global as a sample. In production, choose based on latency and regulatory requirements.
Typical failures include location mismatches, attaching the wrong SA, over-/under-scoped KMS roles, and broken Workload Identity bindings. Cross-reference error messages with audit logs for fast isolation.
Example procedure (gcloud + Vault config)
# 0) 変数
PROJECT_ID="my-project"
LOCATION="global"
KEYRING="vault-unseal"
KEY="vault-unseal-key"
UNSEAL_SA_NAME="vault-unseal-sa"
UNSEAL_SA="${UNSEAL_SA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com"
# 1) SA作成(Unseal用)
gcloud iam service-accounts create ${UNSEAL_SA_NAME} \
--project=${PROJECT_ID} \
--description="Vault Auto Unseal runtime SA" \
--display-name="Vault Unseal SA"
# 2) KMSキーリングとキー(対称鍵)
gcloud kms keyrings create ${KEYRING} \
--location=${LOCATION} --project=${PROJECT_ID}
gcloud kms keys create ${KEY} \
--location=${LOCATION} --keyring=${KEYRING} \
--purpose=encryption --project=${PROJECT_ID}
# 3) 最小権限の付与(cryptoKeyスコープ)
gcloud kms keys add-iam-policy-binding ${KEY} \
--location=${LOCATION} --keyring=${KEYRING} \
--member=serviceAccount:${UNSEAL_SA} \
--role=roles/cloudkms.cryptoKeyEncrypterDecrypter \
--project=${PROJECT_ID}
# 4) GCEにアタッチ(例)
# インスタンステンプレートで --service-account ${UNSEAL_SA}
# GKEの場合はWorkload IdentityでGSA:${UNSEAL_SA}をKSAにバインド
# 5) Vaultサーバ設定(gcpckmsシール)
# region はKMSのlocationに合わせる(例: global, us-east1 など)
cat >/etc/vault.d/vault.hcl <<'EOF'
ui = true
listener "tcp" {
address = "0.0.0.0:8200"
tls_disable = 1
}
storage "raft" {
path = "/opt/vault/data"
}
seal "gcpckms" {
project = "my-project"
region = "global" # = KMS location
key_ring = "vault-unseal"
crypto_key = "vault-unseal-key"
}
EOF
# 6) 起動と初期化
# systemctl enable --now vault
# vault operator init -key-shares=1 -key-threshold=1
# -> Auto Unsealのため、起動時にKMSへ自動Decrypt呼び出し
# トラブルシュートの要点
# - permission denied: iamPolicyBindingの対象が"cryptoKey"か再確認
# - location mismatch: vault.hclのregionとKMSキーlocationが同一か
# - Workload Identity: KSA<->GSAバインド、トークンのAudience設定を再確認
# - 429 / rate limit: 再試行間隔、起動のスロットリング、KMS割当の見直しOps
問題 1
You operate Vault's GCP KMS Auto Unseal on GKE and want a least-privilege design. Which configuration is correct?
正解: A
Following least privilege, grant only roles/cloudkms.cryptoKeyEncrypterDecrypter scoped to the target cryptoKey to the GSA, and on GKE bind the KSA to the GSA via Workload Identity. Distributing key files, granting excessive admin/editor roles, and location mismatches are all incorrect.
Does rotating a KMS key affect Vault Auto Unseal?
Cloud KMS key rotation activates a new version, and with roles/cloudkms.cryptoKeyEncrypterDecrypter you can still Decrypt older versions. Vault automatically continues Encrypt/Decrypt with the new version. After rotation, verify a clean startup against the audit logs to be safe.
Can multiple Vault clusters share the same KMS key?
Technically possible but not recommended. For operational and audit isolation and to limit blast radius, dedicate a cryptoKey (or at least a dedicated keyring/cryptoKey) per cluster, and separate the service accounts as well.
Is it OK to use service account JSON key files?
Possible but discouraged. Distributing key files introduces leak risk and rotation overhead. On GCE, attach the SA to the instance; on GKE, bind KSA to GSA via Workload Identity. These follow the official recommendation for safe implementation.
Practice with certification-focused question sets
無料で問題を解いてみるNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Vault Core Concepts: Sealed/Unsealed, Auth, Secrets (2026)
Vault fundamentals — sealed/unsealed state, auth methods, se...
Vault Operations Professional (VOP-003): Complete Guide (2026)
Pass the Vault Operations Professional exam — enterprise pat...
Vault Path-Based Routing: API URL Structure (2026)
How Vault's path-based routing works — mount points, sub-pat...
Vault Tokens: Auth Token Mechanics (2026)
Token fundamentals — service vs. batch tokens, accessor, ren...
Vault Token Types: Service, Batch, Periodic (2026)
Service vs. batch tokens compared — performance, ACL behavio...