<p>When deploying the app, certain environment-specific settings need to be applied to the server.xml, which cannot be applied when the container is built. Has anyone tried using a volume_mounted config file, and where would I tell tomcat the location of this custom config?</p>

<p>To illustrate <a href="https://stackoverflow.com/users/19246531/nataraj-medayhal">Nataraj Medayhal</a>, you can find an example based on configMap on <a href="https://github.com/devlinx9/k8s_tomcat_custer" rel="nofollow noreferrer"><code>devlinx9/k8s_tomcat_custer</code></a></p>
<blockquote>
<p>The configMap is used to control the configuration of tomcat, in this we added the cluster configuration, save the following text in a file <code>configmap-tomcat.yaml</code></p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: ConfigMap
metadata:
 name: testconfig
data:
 server.xml: |
   &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;

   &lt;Server port=&quot;8005&quot; shutdown=&quot;SHUTDOWN&quot;&gt;
     &lt;Listener className=&quot;org.apache.catalina.startup.VersionLoggerListener&quot; /&gt;

     &lt;Listener className=&quot;org.apache.catalina.core.AprLifecycleListener&quot; SSLEngine=&quot;on&quot; /&gt;
...
   &lt;/Server&gt;
</code></pre>
<p>Create the configMap:</p>
<pre><code>kubectl apply -f configmap-tomcat.yaml -n {namespace}
</code></pre>
</blockquote>
