<p>I am working on Java <strong>Springboot</strong> with <strong>MongoDB</strong> using <strong>Kubernetes</strong>. Currently I just hard coded the URI in application properties and I would like to know </p>

<p>how can I access to the MongoDB credentials on Kubernetes with Java? </p>

<p>The recommended way of passing credentials to Kubernetes pods is to use <a href="https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/" rel="nofollow noreferrer">secrets</a> and to expose them to the application either as environment variables, or as a volume. The link above describes in detail how each approach works.</p>
