title: Kubernetes deployment multiple replicas - how to pass replica number to pod
body: <p>A new Kubernetes Deployment with 2+ replicas for high availability.</p>
  
  <p>I want to be able to execute a command on the first pod only, let's say create a DB, and let the other replicas wait for the first one to complete.<br>
  To implement this, I just want to know in the pod if this is replica #1 or not.</p>
  
  <p>So in the pod's entry point I can test:</p>
  
  <pre><code>if [ $REPLICA_ID -eq 1 ]; then 
      CreateDB
  else
      WaitForDB
  fi
  </code></pre>
  
  <p>Can this be done in Kubernetes?</p>