<p>I need to oveeride some of properties defined in a application.yml of Spring Boot application running in k8s. How can I do this? The only way I found is to mount whole application.yml but I only need to override one property.</p>

x__dos
<p>Could be doable in another way, that's why i'm answering again.
Do it in an easy way.</p>
<p>Create your application.yml in a configmap and mount it as a sub directory called config into the same directory where the spring boot jar ins located.</p>
<p>The documentation of <a href="https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config-files" rel="noreferrer">spring boot (external application properties)</a> says:</p>
<blockquote>
<p>Spring Boot will automatically find and load application.properties and application.yaml files from the following locations when your application starts:</p>
<p>The classpath root</p>
<p>The classpath /config package</p>
<p>The current directory</p>
<p>The /config subdirectory in the current directory</p>
<p>Immediate child directories of the /config subdirectory</p>
</blockquote>
<p>Which means we don't have to take care of setting anything. It should find the config inside the subdirectory config.</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
name: spring-application-config
data:
  application.yml: |
    spring:
      application:
        name: This is just an example, add as many values as you want.
</code></pre>
<p>pod.yaml:</p>
<pre><code>...
    volumeMounts:
    - name: spring-application-config
      mountPath: /app/config
  - name: spring-application-config
    configMap:
      name: spring-application-config
...
</code></pre>
<p>Assuming that your spring boot jar file is located in the path <em><strong>/app</strong></em></p>
