Skip to content

Commit 14fc0b0

Browse files
authored
Revise workload identity documentation for clarity
Updated documentation for workload identity support on static provisioning, including clarifications on NFS mount support, role assignments, and instructions for creating managed identities.
1 parent 721b26e commit 14fc0b0

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

docs/workload-identity-static-pv-mount.md

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,47 @@
22
- supported from v1.24.0 (from AKS 1.29 with `tokenRequests` field support in `CSIDriver`)
33

44
### Note
5-
- This feature is not supported for NFS mount since NFS mount does not need credentials.
6-
- This feature would retrieve storage account key using federated identity credentials by default.
7-
- This feature supports mounting with workload identity token only (**Preview**) by configuring the following:
8-
> limitation: the workload identity token would expire after 24 hours, make sure the blobfuse volume would be remounted by your application before it expires
9-
- set `mountWithWorkloadIdentityToken: "true"` in parameters of storage class or persistent volume
10-
- set `Storage Blob Data Contributor` role on the identity
5+
- This feature is not supported for NFS mount since NFS mount does not need credentials during mount.
6+
- This feature would retrieve storage account key using federated identity credentials by default, you could mount with workload identity token only (**Preview**) by configuring as following:
7+
> mounting with workload identity token only is supported from v1.27.0
8+
- set `mountWithWorkloadIdentityToken: "true"` in `parameters` of storage class or persistent volume
9+
- grant `Storage Blob Data Contributor` role instead of `Storage Account Contributor` role to the managed identity
1110

1211
## Prerequisites
1312
### 1. Create a cluster with oidc-issuer enabled and get the credential
1413

15-
Following the [documentation](https://learn.microsoft.com/en-us/azure/aks/use-oidc-issuer#create-an-aks-cluster-with-oidc-issuer) to create an AKS cluster with the `--enable-oidc-issuer` parameter and get the AKS credentials. And export following environment variables:
16-
```
14+
Refer to the [documentation](https://learn.microsoft.com/en-us/azure/aks/use-oidc-issuer#create-an-aks-cluster-with-oidc-issuer) for instructions on creating a new AKS cluster with the `--enable-oidc-issuer` parameter and get the AKS credentials. And export following environment variables:
15+
```console
1716
export RESOURCE_GROUP=<your resource group name>
1817
export CLUSTER_NAME=<your cluster name>
1918
export REGION=<your region>
2019
```
2120

2221
### 2. Bring your own storage account and storage container
23-
Following the [documentation](https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-cli) to create a new storage account and container or use your own. And export following environment variables:
24-
```
22+
Refer to the [documentation](https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-cli) for instructions on creating a new storage account and container, or alternatively, utilize your existing storage account and container. And export following environment variables:
23+
```console
2524
export STORAGE_RESOURCE_GROUP=<your storage account resource group>
2625
export ACCOUNT=<your storage account name>
2726
export CONTAINER=<your storage container name>
2827
```
2928

30-
### 3. Create managed identity and role assignment
31-
```
29+
### 3. Create or bring your own managed identity and role assignment
30+
> you could leverage the default user assigned managed identity bound to the AKS agent node pool(with naming rule [`AKS Cluster Name-agentpool`](https://docs.microsoft.com/en-us/azure/aks/use-managed-identity#summary-of-managed-identities)) in node resource group
31+
```console
3232
export UAMI=<your managed identity name>
3333
az identity create --name $UAMI --resource-group $RESOURCE_GROUP
3434

3535
export USER_ASSIGNED_CLIENT_ID="$(az identity show -g $RESOURCE_GROUP --name $UAMI --query 'clientId' -o tsv)"
3636
export IDENTITY_TENANT=$(az aks show --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --query identity.tenantId -o tsv)
3737
export ACCOUNT_SCOPE=$(az storage account show --name $ACCOUNT --query id -o tsv)
38+
```
39+
- grant `Storage Account Contributor` role to the managed identity to retrieve account key (default)
40+
```console
41+
az role assignment create --role "Storage Account Contributor" --assignee $USER_ASSIGNED_CLIENT_ID --scope $ACCOUNT_SCOPE
42+
```
3843

39-
# please retry if you meet `Cannot find user or service principal in graph database` error, it may take a while for the identity to propagate
44+
- grant the `Storage Blob Data Contributor` role to the managed identity for mounting using a workload identity token exclusively, without relying on account key authentication.
45+
```console
4046
az role assignment create --role "Storage Account Contributor" --assignee $USER_ASSIGNED_CLIENT_ID --scope $ACCOUNT_SCOPE
4147
```
4248

@@ -66,7 +72,7 @@ az identity federated-credential create --name $FEDERATED_IDENTITY_NAME \
6672
--subject system:serviceaccount:${SERVICE_ACCOUNT_NAMESPACE}:${SERVICE_ACCOUNT_NAME}
6773
```
6874
## option#1: dynamic provisioning with storage class
69-
```
75+
```yaml
7076
cat <<EOF | kubectl apply -f -
7177
apiVersion: storage.k8s.io/v1
7278
kind: StorageClass

0 commit comments

Comments
 (0)