New to Kestra?
Use blueprints to kickstart your first workflows.
Automate Vault secret rotation into Kubernetes with Kestra: read from Vault, patch the Secret, trigger a rolling restart, and verify the Deployment rollout.
Rotating credentials is only half the job: once a secret changes in HashiCorp Vault, the Kubernetes Secret that mirrors it and every pod that mounted the old value still need to catch up. This blueprint closes that gap end to end. It reads the current secret from a Vault HTTP endpoint, patches the matching Kubernetes Secret with the new base64-encoded value, triggers a rolling restart of the Deployment so running pods pick up the rotated credential, and reads the Deployment back to confirm the rollout landed. The result is a repeatable, auditable secret-rotation pipeline for Kubernetes workloads instead of a manual kubectl ritual nobody wants to own.
read_from_vault (io.kestra.plugin.core.http.Request) issues a GET to the vault_path URL, authenticating with the X-Vault-Token header so it returns the current secret payload.patch_secret (io.kestra.plugin.kubernetes.kubectl.Patch) applies a JSON_MERGE patch to the secret named by secret_name, writing the value extracted from the Vault response (parsed with jq and base64encode) into the Secret's password key.restart_deployment (io.kestra.plugin.kubernetes.kubectl.Restart) performs a rolling restart of the named Deployment, the same operation as kubectl rollout restart, so pods remount the refreshed Secret.verify_rollout (io.kestra.plugin.kubernetes.kubectl.Get) reads the deployments resource back with fetchType: FETCH to confirm the new rollout.io.kestra.plugin.core.trigger.Schedule trigger (weekly_rotation, cron 0 3 * * 0) is included so you can flip rotation to a weekly cadence.kubectl patch.Vault can store and version secrets, and Kubernetes can mount them, but neither one reaches across the boundary to patch the cluster Secret and force the pods to reload it. Kestra wires the two together as one declarative YAML flow: event or schedule triggers drive it, retries and error handling cover transient API failures, and every run is logged with inputs and outputs for full rotation lineage. You get the cross-system glue that Vault's own lease renewal and Kubernetes' reconciler cannot provide on their own.
VAULT_TOKEN: token used to read the secret from Vault.K8S_MASTER_URL: Kubernetes API server URL.K8S_TOKEN: OAuth token for the Kubernetes API.VAULT_TOKEN, K8S_MASTER_URL, and K8S_TOKEN as secrets in your Kestra namespace.vault_path at the Vault endpoint that returns your secret.namespace, secret_name, and deployment_name set for your workload.outputs.verify_rollout to confirm the Deployment rolled successfully.jq path in patch_secret to match your Vault secret layout, or patch multiple keys at once.weekly_rotation trigger, or swap it for a Flow trigger fired when Vault emits a rotation event.verify_rollout.ForEach loop over a list input.