title: What is the best practice for service discovery on the application layer in Kubernetes?
body: <p>I have 3 applications. </p>
  
  <p>A Gateway, ServiceA &amp; ServiceB. </p>
  
  <p>Each application sits in its own namespace. Whenever there is a push to the CI/CD server on one of the all the 3. All get deployed based on the branch name. </p>
  
  <p>Example:</p>
  
  <ol>
  <li>Create a new branch (feature-1) in ServiceA repo. </li>
  <li>Make and commit some changes</li>
  <li>The build server builds and deploys the <code>feature-1</code> branch with a unique service name to the Kubernetes cluster. </li>
  <li>The build server looks at ServiceB and Gateway for branches <code>feature-1</code> if not found defaults to <code>develop</code>. For the gateway it creates a <code>feature-1</code> from <code>develop</code> and deploys that one. </li>
  <li>The gateway then needs to know the DNS URL of the ServiceA from <code>feature-1</code> in order to be able to call it. </li>
  </ol>
  
  <p>So my question is how to do service discovery on the application lvl using kubernetes?</p>