Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvz committed Feb 23, 2023
1 parent 6336c4e commit e23c004
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions docs/workload-identity.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# How to Use workload identity with Azurefile

## Prerequisites
This document is mainly refer to [Azure AD Workload Identity Quick Start](https://azure.github.io/azure-workload-identity/docs/quick-start.html). Please Complete the [Prerequisites part](https://azure.github.io/azure-workload-identity/docs/installation.html#prerequisites) of the installation guide before the following steps. The [Azure AD Workload Identity Components part](https://azure.github.io/azure-workload-identity/docs/installation.html#azure-ad-workload-identity-components) is **NOT** required.
This document is mainly refer to [Azure AD Workload Identity Quick Start](https://azure.github.io/azure-workload-identity/docs/quick-start.html). Please Complete the [Prerequisites part](https://azure.github.io/azure-workload-identity/docs/installation.html#prerequisites) of the installation guide before the following steps. Please note the [Azure AD Workload Identity Components part](https://azure.github.io/azure-workload-identity/docs/installation.html#azure-ad-workload-identity-components) is **NOT** required.

After you finish the [Prerequisites part](https://azure.github.io/azure-workload-identity/docs/installation.html#prerequisites) of the Installation guide, you should have obtained your cluster’s OIDC issuer URL.


## Export environment variables
## 1. Export environment variables
```shell
export OIDC_ISSUER="<your cluster’s OIDC issuer URL>"
export AZURE_FILE_RESOURCE_GROUP="<resource group where Azurefile storage account reside>"
Expand All @@ -26,7 +26,7 @@ export SA_LIST=( "csi-azurefile-controller-sa" "csi-azurefile-node-sa" )
export NAMESPACE="kube-system"
```

## Create Azurefile resource group
## 2. Create Azurefile resource group
If you are using AKS, you can get the resource group where Azurefile storage class reside by running:
```shell
export AZURE_FILE_RESOURCE_GROUP="$(az aks show --name $CLUSTER_NAME --resource-group $CLUSTER_RESOURCE_GROUP --query "nodeResourceGroup" -o tsv)"
Expand All @@ -37,7 +37,7 @@ You can also create resource group by yourself, but you must [specify the resour
az group create -n $AZURE_FILE_RESOURCE_GROUP -l $LOCATION
```

## Create an AAD application or user-assigned managed identity and grant required permissions
## 3. Create an AAD application or user-assigned managed identity and grant required permissions
```shell
# create an AAD application if using Azure AD Application for this tutorial
az ad sp create-for-rbac --name "${APPLICATION_NAME}"
Expand All @@ -64,7 +64,7 @@ export AZURE_FILE_RESOURCE_GROUP_ID="$(az group show -n $AZURE_FILE_RESOURCE_GRO
az role assignment create --assignee $USER_ASSIGNED_IDENTITY_OBJECT_ID --role Contributor --scope $AZURE_FILE_RESOURCE_GROUP_ID
```

## Establish federated identity credential between the identity and the Azurefile service account issuer & subject
## 4. Establish federated identity credential between the identity and the Azurefile service account issuer & subject
If using Azure AD Application:
```shell
# Get the object ID of the AAD application
Expand Down Expand Up @@ -101,15 +101,16 @@ az identity federated-credential create \
done
```

## Deploy Azurefile
## 5. Deploy Azurefile

Deploy storageclass:
```shell
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/storageclass-azurefile-csi.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/storageclass-azurefile-nfs.yaml
```

Deploy Azurefile(If you are using AKS, please disable the managed Azurefile CSI driver by `--disable-file-driver` first):
Deploy Azurefile(If you are using AKS, please disable the managed Azurefile CSI driver by `--disable-file-driver` first)

If using Azure AD Application:
```shell
export CLIENT_ID="$(az ad sp list --display-name "${APPLICATION_NAME}" --query '[0].appId' -otsv)"
Expand All @@ -130,8 +131,9 @@ helm install azurefile-csi-driver charts/latest/azurefile-csi-driver \
--set workloadIdentity.tenantID=$TENANT_ID
```

## Deploy application using Azurefile
## 6. Deploy application using Azurefile
```shell
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/nfs/statefulset.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/azurefile-csi-driver/master/deploy/example/deployment.yaml
```
```
Please make sure all the Pods are running.

0 comments on commit e23c004

Please sign in to comment.