How to deploy complex application in Kubernetes

10/24/2019

Let's say I have classic application with

  • Web
  • Backend
  • DB

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.

How can I deploy everything at once?

-- Zveratko
deployment
kubernetes

2 Answers

10/24/2019

You need multiple Kubernetes objects for this and there is multiple ways to solve this.

Web - it depends what this is. Is it just static 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. KubeCDN.

Backend - When using Kubernetes, we design a backend to be stateless following the Twelve Factor principles. This kind of application is deployed on Kubernetes using a Deployment 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 Service and you want to expose this service with a loadbalancer/proxy using an Ingress.

DB - this is a stateful application, if deployed on Kubernetes, this kind of application is deployed as a StatefulSet and you also need to think about how you handle the storage with this, it may possibly be handled with Kubernetes Persistent Volume.

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 my-application/ and deploy all files with a single command:

kubectl apply -f my-application/

However, there is more alternatives to this, e.g. using Helm

-- Jonas
Source: StackOverflow

10/24/2019

Use helm. You create one helm chart for each of your applications and you can also link them with dependencies (requirements). You can then easily deploy them as one application.

-- serg
Source: StackOverflow