apiVersion: v1
kind: Pod
metadata:
  name: etcd-pod-$AC_NAME
  labels:
    app: etcd
    etcd_node: etcd-$AC_NAME
spec:
  containers:
  - image: etcdjob
    name: etcd-$AC_NAME
    env:
      - name: HOSTNAME
        value: etcd-$AC_NAME
      - name: ETCD_NAME
        valueFrom:
          configMapKeyRef:
            name: etcd-node-$AC_NAME
            key: ETCD_NAME
      - name: ETCD_INITIAL_CLUSTER
        valueFrom:
          configMapKeyRef:
            name: etcd-node-$AC_NAME
            key: ETCD_INITIAL_CLUSTER
      - name: ETCD_INITIAL_CLUSTER_STATE
        valueFrom:
          configMapKeyRef:
            name: etcd-node-$AC_NAME
            key: ETCD_INITIAL_CLUSTER_STATE
    command:
      - etcd
      - --initial-advertise-peer-urls
      - http://$HOSTNAME:2380
      - --listen-peer-urls
      - http://0.0.0.0:2380
      - --listen-client-urls
      - http://0.0.0.0:2379
      - --advertise-client-urls
      - http://$HOSTNAME:2379
    ports:
    - containerPort: 2379
      name: client
      protocol: TCP
    - containerPort: 2380
      name: server
      protocol: TCP
  restartPolicy: Never





