<p>Let's say I have classic application with </p>

<ul>
<li>Web</li>
<li>Backend</li>
<li>DB</li>
</ul>

<p>If I understand correctly I will create deployment for each of them. What if I want to deploy all in one step? How should I group the deployments. I have read something about labels and services, I'm totally not sure which concept is the right one. There are two ports necessary to face outside(http and debug). Just for clarity skipping any DB initializations and readiness probes.</p>

<p>How can I deploy everything at once? </p>

Zveratko
<p>You need multiple Kubernetes objects for this and there is multiple ways to solve this.</p>

<p><strong>Web</strong> - it depends what this is. Is it just <strong>static</strong> JavaScript files? In that case, it is easiest to deploy it with a CDN solution, on any cloud provider, an on-prem solution or possible using a Kubernetes based product like e.g. <a href="https://github.com/ilhaan/kubeCDN" rel="nofollow noreferrer">KubeCDN</a>.</p>

<p><strong>Backend</strong> - When using Kubernetes, we design a backend to be <strong>stateless</strong> following the <a href="https://12factor.net/" rel="nofollow noreferrer">Twelve Factor</a> principles. This kind of application is deployed on Kubernetes using a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="nofollow noreferrer">Deployment</a> that will rollout one or more instances of your application, possible elastically scaled depending on load. In front of all your instances, you need a <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">Service</a> and you want to expose this service with a loadbalancer/proxy using an <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">Ingress</a>.</p>

<p><strong>DB</strong> - this is a <strong>stateful</strong> application, if deployed on Kubernetes, this kind of application is deployed as a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="nofollow noreferrer">StatefulSet</a> and you also need to think about how you handle the storage with this, it may possibly be handled with Kubernetes <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/" rel="nofollow noreferrer">Persistent Volume</a>.</p>

<p>As you see, many Kubernetes objects is needed for this setup. If you use plain declarative Kubernetes yaml files, you can have them in a directory e.g <code>my-application/</code> and deploy all files with a single command:</p>

<pre><code>kubectl apply -f my-application/
</code></pre>

<p>However, there is more alternatives to this, e.g. using <a href="https://helm.sh/" rel="nofollow noreferrer">Helm</a></p>
