Skip to content

Commit 2d16bd3

Browse files
committed
docs: add KMS encryption documentation for self-managed Azure
- Add Key Vault Crypto User role assignment instructions for KMS identity in self-managed Azure cluster creation guide - Add KMS role assignment warning callout in workload identity setup guide - Update aggregated docs and API reference with KMS workload identity fields Signed-off-by: Bryan Cox <brcox@redhat.com> Commit-Message-Assisted-by: Claude (via Claude Code)
1 parent 2f84e81 commit 2d16bd3

4 files changed

Lines changed: 248 additions & 2 deletions

File tree

docs/content/how-to/azure/azure-workload-identity-setup.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ hypershift create iam azure \
5252
--output-file workload-identities.json
5353
```
5454

55-
This creates 7 managed identities with federated credentials for:
55+
This creates 8 managed identities with federated credentials for:
5656

5757
- Disk CSI driver
5858
- File CSI driver
@@ -61,6 +61,11 @@ This creates 7 managed identities with federated credentials for:
6161
- Cloud Provider
6262
- NodePool Management
6363
- Network Operator
64+
- KMS (Key Management Service) — for Azure Key Vault etcd encryption at rest
65+
66+
!!! warning "KMS Key Vault Role Assignment"
67+
68+
If you plan to use KMS encryption, you must **manually** assign the `Key Vault Crypto User` role to the KMS identity on your Key Vault. The `--auto-assign-roles` flag does not cover this because the Key Vault scope is user-provided. See [Enabling KMS Encryption](create-self-managed-azure-cluster.md#enabling-kms-encryption-etcd-encryption-at-rest) for the role assignment commands.
6469

6570
For complete documentation on the IAM commands, see [Create Azure IAM Resources Separately](create-iam-separately.md).
6671

docs/content/how-to/azure/create-self-managed-azure-cluster.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,108 @@ ${HYPERSHIFT_BINARY_PATH}/hypershift create nodepool azure \
247247
- `--diagnostics-storage-account-type Managed`: Use Azure managed storage for diagnostics
248248
- `--control-plane-operator-image`: Custom HyperShift operator image (optional)
249249

250+
## Enabling KMS Encryption (etcd Encryption at Rest)
251+
252+
Self-managed Azure HostedClusters support encrypting etcd data at rest using [Azure Key Vault](https://learn.microsoft.com/en-us/azure/key-vault/general/overview) with the KMSv2 protocol. This requires:
253+
254+
1. An Azure Key Vault with a cryptographic key
255+
2. A workload identity with `Key Vault Crypto User` role on the Key Vault
256+
257+
### Prerequisites
258+
259+
Ensure the `kms` workload identity is included in your `workload-identities.json` file. If you used `hypershift create iam azure`, the KMS identity is created automatically.
260+
261+
### Create a Key Vault and Key
262+
263+
```bash
264+
# Create Key Vault
265+
KV_NAME="${PREFIX}-kv"
266+
az keyvault create \
267+
--name "${KV_NAME}" \
268+
--resource-group "${MANAGED_RG_NAME}" \
269+
--location "${LOCATION}" \
270+
--enable-rbac-authorization
271+
272+
# Create encryption key
273+
KEY_NAME="${PREFIX}-etcd-key"
274+
az keyvault key create \
275+
--vault-name "${KV_NAME}" \
276+
--name "${KEY_NAME}" \
277+
--kty RSA \
278+
--size 2048
279+
280+
# Get the key ID (used as --encryption-key-id)
281+
ENCRYPTION_KEY_ID=$(az keyvault key show \
282+
--vault-name "${KV_NAME}" \
283+
--name "${KEY_NAME}" \
284+
--query key.kid -o tsv)
285+
```
286+
287+
### Assign Key Vault Crypto User Role to the KMS Identity
288+
289+
!!! warning "Manual Step Required"
290+
291+
The `--auto-assign-roles` / `--assign-service-principal-roles` flag does **not** assign the Key Vault role because the Key Vault scope is user-provided and not known to the CLI at role-assignment time. You must perform this role assignment manually.
292+
293+
Grant the KMS workload identity the `Key Vault Crypto User` role on your Key Vault so it can encrypt and decrypt etcd data:
294+
295+
```bash
296+
# Get the principal ID of the KMS managed identity
297+
# The identity name follows the pattern: {clusterName}-kms-{infraID}
298+
# List identities in the resource group to find the exact name:
299+
# az identity list --resource-group "${PERSISTENT_RG_NAME}" --query "[?contains(name, 'kms')]" -o table
300+
KMS_MI_NAME=$(az identity list \
301+
--resource-group "${PERSISTENT_RG_NAME}" \
302+
--query "[?contains(name, '${CLUSTER_NAME}-kms')].name" -o tsv)
303+
KMS_PRINCIPAL_ID=$(az identity show \
304+
--name "${KMS_MI_NAME}" \
305+
--resource-group "${PERSISTENT_RG_NAME}" \
306+
--query principalId -o tsv)
307+
308+
# Get the Key Vault resource ID
309+
KV_ID=$(az keyvault show --name "${KV_NAME}" --query id -o tsv)
310+
311+
# Assign Key Vault Crypto User role to the KMS identity
312+
az role assignment create \
313+
--assignee-object-id "${KMS_PRINCIPAL_ID}" \
314+
--assignee-principal-type ServicePrincipal \
315+
--role "Key Vault Crypto User" \
316+
--scope "${KV_ID}"
317+
```
318+
319+
### Create the Cluster with KMS
320+
321+
Add the `--encryption-key-id` flag to your cluster creation command:
322+
323+
```bash
324+
${HYPERSHIFT_BINARY_PATH}/hypershift create cluster azure \
325+
--name "$CLUSTER_NAME" \
326+
--namespace "$CLUSTER_NAMESPACE" \
327+
--azure-creds $AZURE_CREDS \
328+
--location ${LOCATION} \
329+
--node-pool-replicas 2 \
330+
--base-domain $PARENT_DNS_ZONE \
331+
--pull-secret $PULL_SECRET \
332+
--generate-ssh \
333+
--release-image ${RELEASE_IMAGE} \
334+
--external-dns-domain ${DNS_ZONE_NAME} \
335+
--resource-group-name "${MANAGED_RG_NAME}" \
336+
--vnet-id "${GetVnetID}" \
337+
--subnet-id "${GetSubnetID}" \
338+
--network-security-group-id "${GetNsgID}" \
339+
--sa-token-issuer-private-key-path "${SA_TOKEN_ISSUER_PRIVATE_KEY_PATH}" \
340+
--oidc-issuer-url "${OIDC_ISSUER_URL}" \
341+
--dns-zone-rg-name ${PERSISTENT_RG_NAME} \
342+
--assign-service-principal-roles \
343+
--workload-identities-file ./workload-identities.json \
344+
--encryption-key-id "${ENCRYPTION_KEY_ID}" \
345+
--diagnostics-storage-account-type Managed
346+
```
347+
348+
!!! note "KMS Authentication"
349+
350+
For self-managed Azure, the KMS provider authenticates using the `kms` workload identity specified in your `workload-identities.json`. This is different from managed Azure (ARO HCP), which uses managed identities with CSI secret store volumes. The `--kms-credentials-secret-name` flag is not needed for self-managed clusters.
351+
250352
## Verification
251353

252354
Check the cluster status and access:

docs/content/reference/aggregated-docs.md

Lines changed: 124 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/content/reference/api.md

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)