<p>I am containerizing spring-boot applications on kubernetes and I want to have a different application property file for each replica of POD.
As I want to have different config for different pod replicas.</p>
<p>Any help on above would be appreciated.</p>

user3132096
<p>They're not really replicas if you want a unique configuration for each pod. I think you may be looking for a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="nofollow noreferrer"><code>StatefulSet</code></a>. Quoting from the docs:</p>
<blockquote>
<p>Like a Deployment, a StatefulSet manages Pods that are based on an identical container spec. Unlike a Deployment, a StatefulSet maintains a sticky identity for each of their Pods. These pods are created from the same spec, but are not interchangeable: each has a persistent identifier that it maintains across any rescheduling.</p>
</blockquote>
<p>For example, given a StatefulSet like this:</p>
<pre><code>apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: example
spec:
  selector:
    matchLabels:
      app: example
  serviceName: &quot;example&quot;
  replicas: 3
  template:
    metadata:
      labels:
        app: example
    spec:
      containers:
      - name: nginx
        image: docker.io/nginxinc/nginx-unprivileged:mainline
        ports:
        - containerPort: 80
          name: http
</code></pre>
<p>I end up with:</p>
<pre><code>$ kubectl get pod
NAME        READY   STATUS    RESTARTS   AGE
example-0   1/1     Running   0          34s
example-1   1/1     Running   0          31s
example-2   1/1     Running   0          28s
</code></pre>
<p>In each pod, I can look at the value of <code>$HOSTNAME</code> to find my unique name, and I could use that to extract appropriate configuration from a directory path/structured file/etc.</p>
