<p>Is there any way to deploy lagom projects on kubernetes in different environments (ie. dev,stage,prod) such that I can use one image with multiple configuration overrides?</p>

<p>For example, let's say I have an environment variable, <code>foo=bar-{{env}}</code>. I want to build and publish one image and override configurations so that in dev <code>foo=bar-dev</code> and in prod <code>foo=bar-prod</code>.</p>

<p>Currently, my understanding is that the <code>application.conf</code> is tied to the image and cannot be overridden. If this is correct, is there a way to work around this so that I do not need to create multiple images, one for each environment?</p>

bgao3
<p>You can do this in a few ways:</p>

<p><strong>Static:</strong></p>

<p>You can create 3 deployments in 3 namespaces and add the env variable to each deployment. You can manage  these variables manually for each deployment:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  namespace: dev
  name: envar-demo
  labels:
    purpose: demonstrate-envars
spec:
  containers:
  - name: java-demo-container
    image: my-super-java-app
    env:
    - name: foo
      value: "bar-dev"
    - name: JAVA_HOME
      value: "/opt/java/jdk1.7.0_05/bin/java"
</code></pre>

<p><strong>Helm</strong>:</p>

<p>You can make helm chart and use 3 files with variables to deploy your application.
To develop charts, you could read the <a href="https://docs.helm.sh/chart_template_guide/#the-chart-template-developer-s-guide" rel="nofollow noreferrer">official documentation</a> or find some examples in <a href="https://github.com/kubernetes/charts" rel="nofollow noreferrer">official Kubernetes repo</a>  </p>
