<p>In namespace A, I have a service <code>nginx</code> running. In namespace B, I can use <code>nginx.A</code> or <code>nginx.A.svc.cluster.local</code> to get access to the <code>nginx</code> in namespace A. </p>

<p>So what's the difference between these two? Which one is more recommended? Why?</p>

<p><strong>Both forms are considered to be correct</strong> (compare with <a href="https://cloud.google.com/blog/products/gcp/kubernetes-best-practices-organizing-with-namespaces" rel="nofollow noreferrer">this</a> article) and in majority of cases work fine however I could find a few issues on <strong>github</strong> when people encountered some problems related only to short names resolution e.g.:</p>

<p><a href="https://github.com/kubernetes/dns/issues/109" rel="nofollow noreferrer">https://github.com/kubernetes/dns/issues/109</a></p>

<p><a href="https://github.com/kubernetes/kubernetes/issues/10014" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/10014</a></p>

<p>As you can read in official <strong>Kubernetes</strong> documentation (<a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/#namespaces-and-dns" rel="nofollow noreferrer">ref1</a>, <a href="https://kubernetes.io/docs/tasks/administer-cluster/namespaces/#understanding-namespaces-and-dns" rel="nofollow noreferrer">ref2</a>), it recommends use of the long form in case of reaching services across namespaces:</p>

<blockquote>
  <p>When you create a Service, it creates a corresponding DNS entry. This
  entry is of the form
  <strong><code>&lt;service-name&gt;.&lt;namespace-name&gt;.svc.cluster.local</code></strong>, which means that if
  a container just uses <strong><code>&lt;service-name&gt;</code></strong>, it will resolve to the service
  which is local to a namespace. This is useful for using the same
  configuration across multiple namespaces such as Development, Staging
  and Production. If you want to reach across namespaces, you need to
  use the <strong>fully qualified domain name (FQDN)</strong>.</p>
</blockquote>

<p>In my opinion it's much better to stick to <a href="https://en.wikipedia.org/wiki/Fully_qualified_domain_name" rel="nofollow noreferrer">FQDN (fully qualified domain name)</a> standard and often being explicit is considered to be a better practice than being implicit.</p>
