<p>I used config map with files but i am experimenting with portable services like supervisor d and other internal tools. </p>

<p>we have golang binary that can be run in any image. what i am trying is to run these binary using configmap.</p>

<p>Example :- 
We have a internal tool written in Go(size is less than 7MB) can be store in config map and we want to mount that config map inside kuberneates pod and want to run it inside pod</p>

<p>Question :- does anyone use it ? Is it a good approach ? What is the best practice ?</p>

Yuvraj
<p>I too faced similar issue while storing elastic.jks keystore binary file in k8s pod.</p>

<p>AFAIK there are two options:</p>

<ul>
<li>Make use of configmap to store binary data. Check <a href="https://github.com/kubernetes/kubernetes/pull/57938" rel="nofollow noreferrer">this</a> out.</li>
</ul>

<p>OR</p>

<ul>
<li>Store your binary file remotely somewhere like in s3 bucket and pull that binary before running actual pod using <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/" rel="nofollow noreferrer">initContainers</a> concept.</li>
</ul>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: alpine
  namespace: default
spec:
  containers:
  - name: myapp-container
    image: alpine:3.1
    command: ['sh', '-c', 'if [ -f /jks/elastic.jks ]; then sleep 99999; fi']
    volumeMounts:
    - name: jksdata
      mountPath: /jks
  initContainers:
  - name: init-container
    image: atlassian/pipelines-awscli
    command: ["/bin/sh","-c"]
    args: ['aws s3 sync s3://my-artifacts/$CLUSTER /jks/']
    imagePullPolicy: IfNotPresent
    volumeMounts:
    - name: jksdata
      mountPath: /jks
    env:
    - name: CLUSTER
      value: dev-elastic
  volumes:
  - name: jksdata
    emptyDir: {}
  restartPolicy: Always
</code></pre>

<p>As @amit-kumar-gupta mentioned the configmap size constraint.</p>

<p>I recommend the second way. </p>

<p>Hope this helps.</p>
