AKS to use existing storage account
Some customers has restriction over storage account being accessible publicly and other policy constraints. This document explains how to use existing storage account create by IT in our AKS cluster.
AKS_PERS_RESOURCE_GROUP=ex-tst AKS_PERS_STORAGE_ACCOUNT_NAME=extostoragetst # Get storage account key STORAGE_KEY=$(az storage account keys list --resource-group $AKS_PERS_RESOURCE_GROUP --account-name $AKS_PERS_STORAGE_ACCOUNT_NAME --query "[0].value" -o tsv) # Echo storage account name and key echo Storage account name: $AKS_PERS_STORAGE_ACCOUNT_NAME echo Storage account key: $STORAGE_KEYkubectl create secret generic azure-secret \ --from-literal=azurestorageaccountname=$AKS_PERS_STORAGE_ACCOUNT_NAME \ --from-literal=azurestorageaccountkey=$STORAGE_KEY \ --namespace <namespace>apiVersion: v1 kind: PersistentVolume metadata: name: exto-azurefile-pv spec: capacity: storage: 10Gi accessModes: - ReadWriteMany azureFile: secretName: azure-secret shareName: aksshare readOnly: false mountOptions: - dir_mode=0777 - file_mode=0777 - uid=0 - gid=0 - mfsymlinks - cache=strict - nosharesock - actimeo=30apiVersion: v1 kind: PersistentVolumeClaim metadata: name: exto-azurefile-pvc spec: accessModes: - ReadWriteMany storageClassName: "" volumeName: exto-azurefile-pv resources: requests: storage: 10Gikubectl apply -f exto-azurefile-pv.yaml kubectl apply -f exto-azurefile-pvc.yaml
Last updated