Learn to install and configure the HashiCorp Vault plugin in ArgoCD for retrieving secrets during application manifest reconciliation.
In this lesson, you’ll learn how to install and configure the HashiCorp Vault plugin in ArgoCD. This Vault plugin enables ArgoCD to retrieve secrets directly from HashiCorp Vault during application manifest reconciliation. We will follow the official documentation’s approach using an initContainer and configuring the ArgoCD ConfigMap.
Below are the detailed steps and configuration examples.
The first step is to modify the ArgoCD repo server deployment. This configuration uses an initContainer that downloads the Vault plugin and makes it available to the main container through a shared volume.
In this deployment configuration, the ArgoCD repo server container mounts a volume named custom-tools. The initContainer called download-tools downloads the Vault plugin using wget, sets executable permission with chmod +x, and moves it to the shared volume.
If you prefer embedding the plugin into a custom image, use a Dockerfile similar to the example below. This approach avoids using an initContainer by baking the Vault plugin directly into your image.
Copy
Ask AI
RUN apt-get update && \ apt-get install -y \ curl \ awscli && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*# Install the AVP plugin (as root so we can copy to /usr/local/bin)ENV AVP_VERSION=0.2.2ENV BIN=argocd-vault-pluginRUN curl -L -o ${BIN} https://github.com/argoproj-labs/argocd-vault-plugin/releases/download/v${AVP_VERSION}/${BIN}RUN chmod +x ${BIN}RUN mv ${BIN} /usr/local/bin# Switch back to non-root userUSER 999
Embedding the plugin in your custom image can simplify deployment in environments where using an initContainer is less desirable.
Once the Vault plugin binary is available, update the ArgoCD ConfigMap to instruct ArgoCD on how to invoke the plugin for manifest generation. Add the following configuration in your ConfigMap:
4. Updating the Repo Server Deployment with Vault Plugin Credentials
Below is a revised ArgoCD repo server deployment example. This configuration includes a secret reference for Vault credentials and updates the Vault plugin version to 1.7.1. Ensure that the environment variable is correctly defined as AVP_VERSION.
After deploying these changes using, for example, kubectl edit deployment argocd-repo-server -n argocd, the repo server downloads the Vault plugin and processes manifests containing Vault annotations.
To use the Vault plugin, enable it within your ArgoCD application. In the ArgoCD UI, create a new application (e.g., Vault Secret App Demo) within the default or demo project. Configure the sync policy to manual and let the target namespace be automatically created.
Within your Git repository, include a secret manifest that uses an annotation to specify the Vault path. An example manifest is:
When the application is synchronized, the Vault plugin detects the annotation, connects to Vault (using the configuration provided either in the repo server’s secret or hard-coded), fetches the secret data from the specified path, and outputs a final Kubernetes Secret manifest.In your ArgoCD application settings, configure the following Vault parameters (adjust based on your environment):
After deploying your application, check the ArgoCD dashboard to ensure that the application status is synced and healthy.
Inspect the application details to confirm sync status and health. The Vault plugin replaces the secret placeholders with the actual data fetched from Vault.
To verify the new Kubernetes Secret with resolved data, run:
Copy
Ask AI
# Verify the namespace and secretkubectl get nskubectl -n <target-namespace> get secrets
To check the content of a secret, decode a value by replacing <secret-name> and <key>: