<p>I want to create a deployment with the name <strong>nginx-dns</strong> which uses <strong>nginx</strong> image. I want ensure that the service and pod are accessible via their respective DNS records.</p>
<pre><code>kubectl expose deployment nginx-dns --name=nginx-dns ...
</code></pre>
<p>or</p>
<pre><code>kubectl expose pod nginx-dns-12234 --name=nginx-dns ...
</code></pre>
<p>Which command is better to use to ensure accessibility of pod ?</p>

O.Man
<p>The fist command exposes a <code>deployment</code> and second one <code>pod</code>. It's always recommended to use <code>deployment</code> over a <code>pod</code> directly. A <code>deployment</code> is a higher level abstraction and is better from no downtime upgrade, rollout/rollback, availability and reliability perspective.</p>
<p>Refer to the use cases of a deployment <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#use-case" rel="nofollow noreferrer">here</a></p>
