-
Notifications
You must be signed in to change notification settings - Fork 58
push secrets management csi provider lab #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
push secrets management csi provider lab #113
Conversation
jblaaa-codes-ms
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@microsoft-github-policy-service agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive documentation for managing secrets in Azure Kubernetes Service (AKS) using the CSI Secrets Provider, Azure Key Vault, and Stakater Reloader. The lab guide walks users through deploying an AKS cluster, configuring workload identity, and demonstrating automatic secret rotation capabilities.
Key Changes:
- Added a complete lab guide for AKS secrets management using CSI provider
- Includes step-by-step instructions for setting up Key Vault, managed identity, and federated credentials
- Demonstrates secret mounting as both files and environment variables with automatic rotation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot open a new pull request to apply changes based on the comments in this thread |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@microsoft-github-policy-service agree |
|
@chzbrgr71 Can you review this PR and provide feedback? Thank you. |
|
Thank you for your PR @jblaaa-codes-ms. We always appreciate the contributions. Hesitating to merge this because we want to avoid labs that are more repeat of our official AKS Docs. This looks similar to the doc here: https://learn.microsoft.com/en-us/azure/aks/csi-secrets-store-configuration-options?tabs=enable%2Cakvp It does seem like the use of Reloader is a good idea and there aren't any other CNCF based tools that do the same. But we want to be sure these labs don't sound like an official Microsoft recommendation. It would be good to incorporate this type of approach using versions for secrets. This article explains the idea. https://azureglobalblackbelts.com/2024/03/05/workload-identity-kv-csi |
swgriffith
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing! Added some recommendations.
|
|
||
| ``` | ||
|
|
||
| ## CSI Secrets Provider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason you wouldnt just enable this on initial cluster creation? It could be good to move this up, and then have a table explaining each feature you're enabling on the cluster and why (ex. KV CSI, OIDC, Workload Identity
| --query id -o tsv) | ||
|
|
||
| # Assign Key Vault Secrets User role to the MI | ||
| az role assignment create \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to scope access to the specific secrets you're accessing, rather than the whole key vault. That would be more of a best practices approach.
See example here:
https://azureglobalblackbelts.com/2024/03/05/workload-identity-kv-csi
| export USER_OBJECT_ID=$(az ad signed-in-user show --query id -o tsv) | ||
|
|
||
| # Assign Key Vault Secrets Officer role to your user | ||
| az role assignment create \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this role being used? If you scope access to get on the specific secret you shouldnt need this more permissive assignment.
| --name "db-connection-string" \ | ||
| --value "Server=myserver.database.windows.net;Database=mydb;User Id=myuser;Password=your-password-here;" | ||
|
|
||
| az keyvault secret set \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another good practice is to get the specific secret version ID and use that rather than as part of the secret provider class specification. That allows users to potentially maintain multiple active versions of a secret during a secret rotation. For example, you may store a blob storage key and then want to rotate the blob keys on a regular basis. By using versions you can have two active versions of a sercret and then expire one after the rollout is complete.
See example here:
https://azureglobalblackbelts.com/2024/03/05/workload-identity-kv-csi#create-the-key-vault-and-secret
|
|
||
| # Create a SecretProviderClass to define which secrets to mount from Key Vault | ||
|
|
||
| # Deploy podinfo with CSI secrets mounted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be good to split the two yaml files into separate calls, rather than running both together. Then you can also add a short explanation about what each step is accomplishing. Don't forget that some people will have no idea what they're looking at, so more explanation is better.
Step 1: Create secret provider class
Step 2: Create deployment referencing secret provider class
| helm repo update | ||
|
|
||
| # Install Reloader | ||
| helm install reloader stakater/reloader \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably add a note that reloader is a great tool for automating the reload of a deployment based on secret or configmap change, but it is one of several ways to accomplish this task, and also is not a Microsoft blessed tool. Basically want to make sure people dont see the use of reloader as an AKS 'blessed' solution...even though it is referenced in some other MSFT docs out there.
Purpose
Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test