Use the Azure Key Vault provider for Secrets Store CSI Driver in an Azure Kubernetes Service (AKS) cluster
The Azure Key Vault provider for Secrets Store CSI Driver allows for the integration of an Azure Key Vault as a secret store with an Azure Kubernetes Service (AKS) cluster via a CSI volume.
Features
- Mounts secrets, keys, and certificates to a pod using a CSI volume.
- Supports CSI inline volumes.
- Supports mounting multiple secrets store objects as a single volume.
- Supports pod portability with the
SecretProviderClassCRD. - Supports Windows containers.
- Syncs with Kubernetes secrets.
- Supports autorotation of mounted contents and synced Kubernetes secrets.
Limitations
A container using subPath volume mount doesn't receive secret updates when it's rotated. For more information, see Secrets Store CSI Driver known limitations.
Prerequisites
- If you don't have an Azure subscription, create a free account before you begin.
- Check that your version of the Azure CLI is 2.30.0 or later. If it's an earlier version, install the latest version.
- If you're restricting Ingress to the cluster, make sure ports 9808 and 8095 are open.
- The minimum recommended Kubernetes version is based on the rolling Kubernetes version support window. Make sure you're running version N-2 or later.
Create an AKS cluster with Azure Key Vault provider for Secrets Store CSI Driver support
Create an Azure resource group using the
az group createcommand.az group create -n myResourceGroup -l eastus2Create an AKS cluster with Azure Key Vault provider for Secrets Store CSI Driver capability using the
az aks createcommand and enable theazure-keyvault-secrets-provideradd-on.Note
If you want to use Microsoft Entra Workload ID, you must also use the
--enable-oidc-issuerand--enable-workload-identityparameters, such as in the following example:az aks create -n myAKSCluster -g myResourceGroup --enable-addons azure-keyvault-secrets-provider --enable-oidc-issuer --enable-workload-identityaz aks create -n myAKSCluster -g myResourceGroup --enable-addons azure-keyvault-secrets-providerThe add-on creates a user-assigned managed identity,
azureKeyvaultSecretsProvider, to access Azure resources. The following example uses this identity to connect to the key vault that stores the secrets, but you can also use other identity access methods. Take note of the identity'sclientIdin the output...., "addonProfiles": { "azureKeyvaultSecretsProvider": { ..., "identity": { "clientId": "<client-id>", ... } }
Upgrade an existing AKS cluster with Azure Key Vault provider for Secrets Store CSI Driver support
Upgrade an existing AKS cluster with Azure Key Vault provider for Secrets Store CSI Driver capability using the
az aks enable-addonscommand and enable theazure-keyvault-secrets-provideradd-on. The add-on creates a user-assigned managed identity you can use to authenticate to your key vault.az aks enable-addons --addons azure-keyvault-secrets-provider --name myAKSCluster --resource-group myResourceGroup
Verify the Azure Key Vault provider for Secrets Store CSI Driver installation
Verify the installation is finished using the
kubectl get podscommand, which lists all pods with thesecrets-store-csi-driverandsecrets-store-provider-azurelabels in the kube-system namespace.kubectl get pods -n kube-system -l 'app in (secrets-store-csi-driver,secrets-store-provider-azure)'Your output should look similar to the following example output:
NAME READY STATUS RESTARTS AGE aks-secrets-store-csi-driver-4vpkj 3/3 Running 2 4m25s aks-secrets-store-csi-driver-ctjq6 3/3 Running 2 4m21s aks-secrets-store-csi-driver-tlvlq 3/3 Running 2 4m24s aks-secrets-store-provider-azure-5p4nb 1/1 Running 0 4m21s aks-secrets-store-provider-azure-6pqmv 1/1 Running 0 4m24s aks-secrets-store-provider-azure-f5qlm 1/1 Running 0 4m25sVerify that each node in your cluster's node pool has a Secrets Store CSI Driver pod and a Secrets Store Provider Azure pod running.
Create or use an existing Azure Key Vault
Create a key vault using the
az keyvault createcommand. The name of the key vault must be globally unique.az keyvault create -n <keyvault-name> -g myResourceGroup -l eastus2Your key vault can store keys, secrets, and certificates. In this example, use the
az keyvault secret setcommand to set a plain-text secret calledExampleSecret.az keyvault secret set --vault-name <keyvault-name> -n ExampleSecret --value MyAKSExampleSecretTake note of the following properties for future use:
- The name of the secret object in the key vault
- The object type (secret, key, or certificate)
- The name of your key vault resource
- The Azure tenant ID of the subscription
Next steps
In this article, you learned how to use the Azure Key Vault provider for Secrets Store CSI Driver in an AKS cluster. You now need to provide an identity to access the Azure Key Vault. To learn how, continue to the next article.
Feedback
Submit and view feedback for