Kubernetes - when should I consider use serverless on Kubernetes or regular service docker

8/15/2019

More of a general question - Assume all my tech stack has to be on K8S (for example cloud vendor agnostic): When should I use serverless on top of K8S (e.g nuclio, kubeless) - and when to keep service as docker? I ask this because the "auto-scaling" I get for free for both of them - so I wonder when I should use another framework...

To simplify - assume everything is stateless...no sessions

-- user1025852
kubernetes
nuclio

1 Answer

8/21/2019

I will start by saying that Serverless is more innovative technology than Docker Containers. However, they both have their advantages and disadvantages.

Serverless

Starting from Serverless, it is possible to build them for virtually any type of application or backend service, and everything required to run and scale your application with high availability is handled for you.

Pros:

  • Deployment simplicity. There’s no need to administrate infrastructure — just upload your functions, and that’s all. No Dockerfiles or Kubernetes configurations.

  • Almost all Serverless solutions support event triggers, which means they are great for pipelines and sequenced workflows.

  • As you pay per function execution, Serverless is cheaper than containers. When an application is not being used, it shuts down, and you don’t pay for the idle time (you have mentioned that you don't have to pay for auto-scaling).

Cons:

  • When the Serverless app grows, it is hard to troubleshoot because of the way the FaaS applications are designed to work.

  • Serverless always depends on a third party vendor, so that changing the cloud provider can be a headache.

Docker Containers

Docker is a containerization platform that packages your application and all its dependencies together in the docker container.

Pros:

  • Container technology enables you to scale your applications as much as you want.
  • Docker containers are vendor-agnostic, whereas going Serverless always depends on a third party.
  • You have full flexibility and control with Docker containers in terms of setting policies, managing resources, and security.

Cons:

  • Containers utilize resources more efficiently than virtual machines, but they are still subject to performance overhead due to overlay networking, interfacing between the container and the host system.
  • By default, all of the data inside a container disappears forever when the container shuts down unless you save it somewhere else first.

Conclusion

If you want to reduce application management and don’t care about the architecture - Serverless is the best option. If you want to deploy an application on specified system architecture with having control over it, then Docker containers are the best option. So when comparing Serverless vs Docker, it comes down to choosing what is better for your particular needs.

I encourage to read interesting article about it.

-- muscat
Source: StackOverflow