Adding configMap as a volume to a container in an OCP deployment

137 views Asked by At

I have a deployment of 3 containers in OCP. In one of them there is a configuration file which I want to mount to the container via configMap. I created a configMap and tried to mount it to the container but it didn't work.

I use 'csanchez jenkins kubernetes' plugin, so the deployment is configured in a yml file and written in xml format. I found this in the docs of the csanchez plugin, tried to add the necessary field to the container field, but it did not worked.

I want to connect it to a single container and not to the pod, because the path of the config file is the same in another one, but the config file differs.

I tried to add to the container field:

<volumeMounts>
  <org.csanchez.jenkins.plugins.kubernetes.volumes.configMapVolume>
    <mountPath>/opt/selenium/config.json</mountPath>
    <configMapName>selenium-config-map</configMapName>
  </org.csanchez.jenkins.plugins.kubernetes.volumes.configMapVolume>
</volumeMounts>

I tried to switch volumeMounts with volumes and it also didn't work.

0

There are 0 answers