<p>I have a yaml file which works if I deploy it using</p>
<pre class="lang-sh prettyprint-override"><code>kubectl apply -f myComponents.yaml
</code></pre>
<p>My question is, is there a way to deploy just one component from this YAML? For example, if my YAML has both deployment and service and I just want to deploy the service</p>
<p>I am looking for something like</p>
<pre class="lang-sh prettyprint-override"><code>kubectl apply -f myComponents.yaml Service
</code></pre>

<p>No. ⛔</p>
<p>At least not yet. Currently, you can take advantage of tools like <a href="https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/" rel="nofollow noreferrer">kustomize</a>, to apply/create/delete what you'd like, but that's not necessarily the same thing.</p>
<p>Having said I've made <a href="https://github.com/kubernetes/kubectl/issues/900" rel="nofollow noreferrer">a feature request for kubectl</a> 💡.</p>
<p>✌️</p>
