title: can i use a configmap created from an init container in the pod
body: <p>I am trying to "pass" a value from the init container to a container. Since values in a configmap are shared across the namespace, I figured I can use it for this purpose. Here is my job.yaml (with faked-out info):</p>
  
  <pre><code>apiVersion: batch/v1
  kind: Job
  metadata:
    name: installer-test
  spec:
    template:
      spec:
        containers:
        - name: installer-test
          image: installer-test:latest
          env:
          - name: clusterId
            value: "some_cluster_id"
          - name: in_artifactoryUrl
            valueFrom:
              configMapKeyRef:
                name: test-config
                key: artifactorySnapshotUrl
        initContainers:
        - name: artifactory-snapshot
          image: busybox
          command: ['kubectl', 'create configmap test-config --from-literal=artifactorySnapshotUrl=http://artifactory.com/some/url']
        restartPolicy: Never
    backoffLimit: 0
  </code></pre>
  
  <p>This does not seem to work (EDIT: although the statements following this edit note may still be correct, this is not working because kubectl is not a recognizable command in the busybox image), and I am assuming that the pod can only read values from a configmap created BEFORE the pod is created. Has anyone else come across the difficulty of passing values between containers, and what did you do to solve this?</p>
  
  <p>Should I deploy the configmap in another pod and wait to deploy this one until the configmap exists?</p>
  
  <p>(I know I can write files to a volume, but I'd rather not go that route unless it's absolutely necessary, since it essentially means our docker images must be coupled to an environment where some specific files exist)</p>