Azure Key Vault
- Encrypt etcd
- Create Azure Key Vault
- Give your azure account access to create secrets
- Create secrets
- Login to Azure CLI
- Create service principal (user allowed to get secrets and restrict to namespace) required per namespace
- Deploy Azure Key Vault Provider for Secrets Store CSI Driver
- Create service principle secret in kubernetes (this will be stored in etcd)
- Create and apply secrets.yaml
- create and apply deployment to use the secret
If you do not have a service principal, run the following Azure CLI command to create a new service principal.
# OPTIONAL: Create a new service principal, be sure to notate the SP secret returned on creation.
az ad sp create-for-rbac --skip-assignment --name $SPNAME
# If you lose your AZURE_CLIENT_SECRET (SP Secret), you can reset and receive it with this command:
# az ad sp credential reset --name $SPNAME --credential-description "APClientSecret" --query password -o tsv
With an existing service principal, assign the following permissions
# Set environment variables
SPNAME=<servicePrincipalName>
AZURE_CLIENT_ID=$(az ad sp show --id http://${SPNAME} --query appId -o tsv)
KEYVAULT_NAME=<key-vault-name>
KEYVAULT_RESOURCE_GROUP=<resource-group-name-for-KV>
SUBID=<subscription-id>
az keyvault set-policy -n $KEYVAULT_NAME --key-permissions get --spn $AZURE_CLIENT_ID
az keyvault set-policy -n $KEYVAULT_NAME --secret-permissions get --spn $AZURE_CLIENT_ID
az keyvault set-policy -n $KEYVAULT_NAME --certificate-permissions get --spn $AZURE_CLIENT_ID