<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-set-up-dynamic-secrets-for-postgres-using-vault-and-spring-boot-on-kubernetes-0nwrdczme" -->

---
title: How to set up dynamic secrets for Postgres using Vault...
description: This article explains how to set up dynamic secrets for Postgres using Vault and Spring Boot on Kubernetes. It discusses the importance of credential...
canonical: https://daily.dev/posts/how-to-set-up-dynamic-secrets-for-postgres-using-vault-and-spring-boot-on-kubernetes-0nwrdczme
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How to set up dynamic secrets for Postgres using Vault and Spring Boot on Kubernetes | daily.dev
og:description: This article explains how to set up dynamic secrets for Postgres using Vault and Spring Boot on Kubernetes. It discusses the importance of credential...
og:url: https://daily.dev/posts/how-to-set-up-dynamic-secrets-for-postgres-using-vault-and-spring-boot-on-kubernetes-0nwrdczme
og:image: https://api.daily.dev/og/posts/0nwrdCZME.png
og:image:alt: How to set up dynamic secrets for Postgres using Vault and Spring Boot on Kubernetes
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to set up dynamic secrets for Postgres using Vault and Spring Boot on Kubernetes

**[Medium](https://daily.dev/sources/medium_js)** · 20 min read · 3 upvotes · 0 comments

## Summary

This article explains how to set up dynamic secrets for Postgres using Vault and Spring Boot on Kubernetes. It discusses the importance of credential management and provides an alternate solution for integrating Spring Boot applications with Vault. The article also outlines the steps to configure Vault for managing Postgres credentials and explains how the Vault Agent retrieves and inserts credentials into the Spring Boot application. Additionally, it covers the process for rotating credentials in Vault, Vault's authentication with Kubernetes, and how the Spring Boot application updates its connections when credentials are rotated. Finally, it provides guidance on deploying the Spring Boot application with Vault Agent.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://medium.com/@martin.hodges/how-to-set-up-dynamic-secrets-for-postgres-using-vault-and-spring-boot-on-kubernetes-757f759d22b4>

---

Tags: [#kubernetes](https://daily.dev/tags/kubernetes), [#database](https://daily.dev/tags/database), [#postgresql](https://daily.dev/tags/postgresql), [#spring-boot](https://daily.dev/tags/spring-boot)

[View this post on daily.dev](https://daily.dev/posts/how-to-set-up-dynamic-secrets-for-postgres-using-vault-and-spring-boot-on-kubernetes-0nwrdczme)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How to set up dynamic secrets for Postgres using Vault and Spring Boot on Kubernetes","url":"https://daily.dev/posts/how-to-set-up-dynamic-secrets-for-postgres-using-vault-and-spring-boot-on-kubernetes-0nwrdczme","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-set-up-dynamic-secrets-for-postgres-using-vault-and-spring-boot-on-kubernetes-0nwrdczme"},"datePublished":"2024-05-07T01:31:03.330Z","dateModified":"2024-05-09T09:06:08.895Z","description":"This article explains how to set up dynamic secrets for Postgres using Vault and Spring Boot on Kubernetes. It discusses the importance of credential...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/33c45da17223f7bd1bcd5454ee0a74eb?_a=AQAEuiZ","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/33c45da17223f7bd1bcd5454ee0a74eb?_a=AQAEuiZ","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-set-up-dynamic-secrets-for-postgres-using-vault-and-spring-boot-on-kubernetes-0nwrdczme","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"kubernetes,database,postgresql,spring-boot","timeRequired":"PT20M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"How to set up dynamic secrets for Postgres using Vault and Spring Boot on Kubernetes"}]}
```

