<p>Due to limitations of <a href="http://kubernetes.io/docs/user-guide/ingress/" rel="nofollow">ingress resources</a> (in my case I need more than 50 routes which is not supported in Google Container Engine) I'm considering using Nginx as a reverse proxy to other backend services. What I want to do is essentially the same as an ingress resource provides such as routing path "/x" to service x and "/y" to service y. I'd like to run more than one instance of Nginx for HA, probably behind a <a href="http://kubernetes.io/docs/user-guide/services/" rel="nofollow">service</a>. My question mainly concerns configuration where I have a couple of options:</p>

<ol>
<li>Create a custom Docker image with nginx as base image and then copy
our nginx configuration into this image. This would make it very
easy to run this nginx-based image on Kubernetes. But while this
works it would require rebuilding, publishing and storing a new
custom nginx image every time the configuration changes. We already
have pipelines setup for this so it won't be a big problem
operationally.</li>
<li>Use the vanilla nginx docker image, create a GCE persistent disk (we're running on Google Container Engine) that is shared between all nginx pods in read only mode. The problem I see with this is approach is how to copy configuration updates to the disk in an easy manner?</li>
<li>Is there a better option? I've looked at config maps and/or secrets (which would solve the configuration update problem) but I don't think they can contain arbitrary data such as an nginx config file.</li>
</ol>

<p>ConfigMaps containing text-files should be no problem at all. Take a look at the <code>--from-file</code> option: <a href="http://kubernetes.io/docs/user-guide/configmap/" rel="nofollow">http://kubernetes.io/docs/user-guide/configmap/</a>.</p>

<p>Im unsure about binary files inside a ConfigMap. I'm able to add a JPEG but trying to read object results in an error so this might not be intended (needs additional base64 encoding or such).</p>

<pre><code>$ kubectl create configmap test --from-file=foo1=/tmp/scudcloud_U0GQ27N0M.jpg
configmap "test" created
$ kubectl get configmap test -o yaml
error: error converting JSON to YAML: %!(EXTRA *errors.errorString=yaml: control characters are not allowed)
</code></pre>
