<p>I have application that have some user settings and it runs on kubernetes cluster.
I would like the user settings to survive application crash/pod restart.</p>
<p>I was thinking first about having a DB instance for keeping it outside of kubernetes. Then I thought, maybe I could just abuse etcd to store small amount of custom data.
Is it a good approach to keep things simple?</p>
<p>Another options I see:</p>
<ol>
<li>separate db instance outside of kubernetes(overkill)</li>
<li>some json file on PV volume in kubernetes being constantly re-read.</li>
<li>perhaps use hashicorp vault?</li>
</ol>
<p>What would you use? Its very small amount of data</p>

Wojtas.Zet
<p><a href="https://kubernetes.io/docs/concepts/configuration/configmap/" rel="nofollow noreferrer">ConfigMaps</a> are designed to store application config/data persistently and allow you to mount the data into one or more application Pods.
There are multiple ways they can be mounted, one common way is via environmental variables.
Here is an example from the docs:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: dapi-test-pod
spec:
  containers:
    - name: test-container
      image: k8s.gcr.io/busybox
      command: [ &quot;/bin/sh&quot;, &quot;-c&quot;, &quot;env&quot; ]
      env:
        # Define the environment variable
        - name: SPECIAL_LEVEL_KEY
          valueFrom:
            configMapKeyRef:
              # The ConfigMap containing the value you want to assign to SPECIAL_LEVEL_KEY
              name: special-config
              # Specify the key associated with the value
              key: special.how
  restartPolicy: Never
</code></pre>
