Mark Jaffe
Mark Jaffe

Reputation: 29

Kubernetes deployment of tomcat docker image needs custom server,xml

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?

Upvotes: 1

Views: 347

Answers (1)

VonC
VonC

Reputation: 1325976

To illustrate Nataraj Medayhal, you can find an example based on configMap on devlinx9/k8s_tomcat_custer

The configMap is used to control the configuration of tomcat, in this we added the cluster configuration, save the following text in a file configmap-tomcat.yaml

apiVersion: v1
kind: ConfigMap
metadata:
 name: testconfig
data:
 server.xml: |
   <?xml version="1.0" encoding="UTF-8"?>

   <Server port="8005" shutdown="SHUTDOWN">
     <Listener className="org.apache.catalina.startup.VersionLoggerListener" />

     <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
...
   </Server>

Create the configMap:

kubectl apply -f configmap-tomcat.yaml -n {namespace}

Upvotes: 1

Related Questions