DEV Community

Ed LeGault for Leading EDJE

Posted on

Container Orchestration: What to choose when and why?

The wonderful world of containers. Lately there are not too many companies that have either already containerized their applications or are in the processes of doing so. Getting a image to build on your laptop and run it as a container is a great first step. Rarely is an application made up of one image. Instead your application "stack" is usually made up of a front-end, a back-end, a database and possibly a queue of some sort. You need the ability to allow the containers within your stack to communicate as well as being able to be independently deployed, updated, scaled and monitored. This is where orchestration software is useful but it comes in a few flavors and forms. Deciding when and why to use a certain one can be tricky. Let's look at a few of the most common options and when and why you would use them.

Docker Compose

Docker compose (docker-compose) is generally distributed with Docker. You can define your multi-container application configuration as code via a single yaml file.

  • Pros:
    • Containers communicate within their own network
    • Start and Stop with a single command
  • Cons:
    • You run your application on a single host
  • Useful When:
    • Spinning up the application for development and integration testing
    • Can easily run in CI/CD tools and pipelines

Docker Swarm

Docker Swarm follows the same yaml syntax as compose with some additional features, such as resiliency and redundancy. It also allows you to manage containers across multiple physical or virtual machines.

  • Pros:
    • Closely follows the docker-compose yaml syntax
    • Can be managed across multiple machines
  • Cons:
    • Doesn't provide a easy-to-use storage option outside of Docker Volumes
    • Poor monitoring
  • Useful When:
    • You don't want to spend a lot of time learning a new syntax or installation

Kubernetes

Kubernetes is a open-source orchestration framework developed by Google and currently maintained by the Cloud Native Computing Foundation.

  • Pros:
    • Consistent configuration as code between on-premise and cloud based implementations
    • Provides constant uptime with fast deployments
    • Adheres to principals of immutable infrastructure
    • Provides declarative configuration
    • Provides auto and manual scaling
    • Distributes load and performs health checks
  • Cons:
    • Installation process and learning the syntax takes time
    • Apps should be updated to provide liveness and readiness urls
  • Useful When:
    • You want a highly available production level application runtime framework

Conclusion

Sometimes the answer is a combination in which docker-compose is used for local and pipeline testing and kubernetes is used in higher environments like QA and Production. The orchestration framework you pick will be largely decided by your goals compared to the infrastructure and complexity that each solution will introduce. Sometimes docker-compose is not enough and other times kubernetes may be overkill. It is up to you to take a look and decide what solution meets your needs in terms of budget, complexity and training costs.

Top comments (1)

Collapse
 
andrewdmay profile image
Andrew May

With my AWS hat on, I will also recommend the Amazon Elastic Container Service (ECS) as a much simpler option than Kubernetes in AWS. The integration with AWS services is generally more straightforward than with the Elastic Kubernetes Service (EKS), and it's more cost effective if you're just running a handful of services.