You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case you have the requirement, that your AKS cluster has to access a blob storage with kubelet identity or a dedicated user-assigned managed identity, the following solution will do this.
4
-
5
-
You can also use a different managed-identity for different persistent volumes (f.e. you have a pod, that should just have write access to some objects while having another pod, that should have write access everywhere.)
1
+
# blobfuse mount with managed identity
6
2
3
+
This article demonstrates the process of utilizing blobfuse mount with either a dedicated user-assigned managed identity or kubelet identity.
7
4
8
5
## Before you begin
6
+
- Make sure the managed identity has `Storage Blob Data Owner` role to the storage account
7
+
> here is an example that uses Azure CLI commands to assign the `Storage Blob Data Owner` role to the managed identity for the storage account. If the storage account is created by the driver(dynamic provisoning), then you need to grant `Storage Blob Data Owner` role to the resource group where the storage account is located
9
8
10
-
- The Azure CLI version 2.37.0 or later. Run `az --version` to find the version, and run `az upgrade` to upgrade the version. If you need to install or upgrade, see [Install Azure CLI][install-azure-cli].
11
-
12
-
- Install the aks-preview Azure CLI extension version 0.5.85 or later.
13
-
14
-
- Ensure, that you are authenticated or run `az login`
15
-
16
-
- Run `az account set --subscription "mysubscription"` to select the right subscription
17
-
18
-
- Create a storage account container(optional in dynamic provisioning), e.g.
19
9
```bash
20
-
resourcegroup="blobfuse-mi"
21
-
storageaccountname="myaksblob"
22
-
az storage account create -g "$resourcegroup" -n "$storageaccountname" --access-tier Hot --sku Standard_LRS
23
-
az storage container create -n mycontainer --account-name "$storageaccountname" --public-access off
az role assignment create --assignee-object-id "$kloid" --role "Storage Blob Data Owner" --scope "$said"
24
13
```
25
14
26
-
- Get the clientID for`AzureStorageIdentityClientID`. If you use kubelet identity, the identity name is `blobfuse-mi-agentpool`, and the resourcegroup is node resourcegroup, or you can use a dedicated user-assigned managed identity
15
+
16
+
- Retrieve the clientID for `AzureStorageIdentityClientID`. If you are using kubelet identity, the identity will be named {aks-cluster-name}-agentpool and located in the node resource group.
27
17
```bash
28
-
az identity list -g "$resourcegroup" --query "[?name == '$identityname'].clientId" -o tsv
## dynamic provisioning in an existing resource group
32
-
33
-
1. Grant cluster system assigned identity(control plane identity) `Storage Account Contributor` role to resource group, if mount in an existing storage account, then should also grant identities to storage account
21
+
## dynamic provisioning
22
+
- Ensure that the system-assigned identity of your cluster control plane has the `Storage Account Contributor role`for the storage account.
23
+
>if the storage account is created by the driver, then you need to grant `Storage Account Contributor` role to the resource group where the storage account is located
34
24
35
-
1. Grant kubelet identity `Storage Blob Data Owner` role to resource group to mount blob storage, if mount in an existing storage account, then should also grant identity to storage account
25
+
> AKS cluster control plane identity already has `Contributor` role on the node resource group by default.
36
26
37
-
1. Create a storage class in an existing resource group
38
-
- Option#1 create storage account by CSI driver, will create a new storage account when `storageAccount` and `containerName` are not provided.
39
-
- Option#2 use your own storage account, set storage account name for`storageAccount`, you can also set an existing container name for`containerName`if you want to mount an existing container.
27
+
1. Create a storage class
40
28
```yml
41
29
apiVersion: storage.k8s.io/v1
42
30
kind: StorageClass
@@ -46,9 +34,9 @@ You can also use a different managed-identity for different persistent volumes (
46
34
parameters:
47
35
skuName: Premium_LRS
48
36
protocol: fuse
49
-
resourceGroup: EXISTING_RESOURCE_GROUP_NAME
50
-
storageAccount: EXISTING_STORAGE_ACCOUNT_NAME # optional, if use existing storage account
51
-
containerName: EXISTING_CONTAINER_NAME # optional, if use existing container
37
+
resourceGroup: EXISTING_RESOURCE_GROUP_NAME# optional, node resource group if it's not provided
38
+
storageAccount: EXISTING_STORAGE_ACCOUNT_NAME # optional, driver will create a new account if it's not provided
39
+
containerName: EXISTING_CONTAINER_NAME # optional, driver will create a new container if it's not provided
0 commit comments