<p>I'm trying to bootstrap a etcd cluster within my kubernetes cluster, here is the relevant section of the pod definition</p>

<pre><code>  - name: etcd
    image: quay.io/coreos/etcd:v2.2.0
    ports:
    - containerPort: 2379
    - containerPort: 2380
    - containerPort: 4001
    env:
    - name: POD_IP
      valueFrom:
        fieldRef:
          fieldPath: status.podIP
    args:
    - "-name"
    - "etcd0"
    - "-advertise-client-urls"
    - http://${POD_IP}:2379,http://${POD_IP}:4001
    - "-initial-advertise-peer-urls"
    - "http://${POD_IP}:2380"
    - "-listen-peer-urls"
    - "http://0.0.0.0:2380"
    - "-initial-cluster"
    - 'etcd0=http://${POD_IP}:2380'
    - "-initial-cluster-state"
    - "new"
</code></pre>

<p>However when I apply the POD_IP environment variable seems to get mangled, evidenced by the log:</p>

<pre><code> advertise URLs of "etcd0" do not match in --initial-advertise-peer-urls [http://$%7BPOD_IP%7D:2380] and --initial-cluster [http://$%7BPOD_IP%7D:2380]
</code></pre>

<p>Has anyone seen anything similar to this?</p>

Tom Hadlaw
<p>The arguments are not interpreted by a shell, so curly braces don't get you the behavior you want. If you want to use an envvar value in an arg, variable references like <code>$(VAR_NAME)</code> are expanded using the container's environment.</p>
