<p>I have encrypted two database passwords with kubeseal, but I am not sure how exactly to mount them in my configuration file assuming I am using Spring Boot.</p>
<p>The application keeps complaining about missing placeholder password.
Could not resolve placeholder 'datasources.eco.password'</p>
<p>Here is the generated secret :</p>
<pre><code>apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
  annotations:
    sealedsecrets.bitnami.com/namespace-wide: &quot;true&quot;
  creationTimestamp: null
  name: database-keys
  namespace: eco-test
spec:
  encryptedData:
    ecoadmin: AgBPqs07GicbU4eyYXfQrVoRHCkfPHH8jxN8...sefwfs4fse
    ecodb: AgAHYRYpk5j+ZCyIDpYr89d8pYLJ6E8S...sr3245sefsf
  template:
    data: null
    metadata:
      annotations:
        sealedsecrets.bitnami.com/namespace-wide: &quot;true&quot;
      creationTimestamp: null
      name: database-keys
      namespace: eco-test
</code></pre>
<p>Here is where I try to mount the secret in my properties file:</p>
<pre><code>   datasources:
      eco:
        #url: jdbc:oracle:thin:@10.246...
        url: jdbc:oracle:thin:@12.234...
        username: ECO
        password:
          secretKeyRef:
            name: database-keys
            key: ecodb
        minPoolSize: 5
        maxPoolSize: 20
        edition: 'REL_2021_12_06'
      ecoadmin:
        #url: jdbc:oracle:thin:@10.246...
        url: jdbc:oracle:thin:@21.32...
        username: ECOADM
        password:
          secretKeyRef:
            name: database-keys
            key: ecoadmin
</code></pre>

JavaGeek
<p>not sure if you are confusing plattform (k8s) with service (springboot) features here.</p>
<p>when you configure your springboot app to expect a value at &quot;datasources.eco.password&quot;, you cannot use the kubernetes method of mounting values from secrets there because it expects something like</p>
<pre><code>datasources:
  eco:
    password: password123

</code></pre>
<p>i assume that you can reference ENVs in your properties file, so one way to go would be to mount the secretsvalue as a ENV and reference that in your properties file.</p>
<p>properties file:</p>
<pre><code>datasources:
  eco:
    #url: jdbc:oracle:thin:@10.246...
    url: jdbc:oracle:thin:@12.234...
    username: ECO
    password: ${DB_ADMIN_KEY_PW}
    minPoolSize: 5
    maxPoolSize: 20
    edition: 'REL_2021_12_06'
  ecoadmin:
    #url: jdbc:oracle:thin:@10.246...
    url: jdbc:oracle:thin:@21.32...
    username: ECOADM
    password: ${DB_ADMIN_KEY_PW}
</code></pre>
<p>deployment.yaml:</p>
<pre><code>kind: Deployment
apiVersion: apps/v1
metadata:
  ...
spec:
  ...
  template:
    ...
    spec:
      ...
      containers:
        - name: &lt;app&gt;
          image: &lt;image&gt;
          env:
            - name: DB_ADMIN_KEY_PW
              valueFrom:
                secretKeyRef:
                  name: database-keys
                  key: ecoadmin
          ...
</code></pre>
<p>references:</p>
<ul>
<li><a href="https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-environment-variables" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-environment-variables</a></li>
<li><a href="https://stackoverflow.com/questions/35531661/using-env-variable-in-spring-boots-application-properties">Using env variable in Spring Boot&#39;s application.properties</a></li>
</ul>
