简体   繁体   中英

How is Docker Swarm different than Kubernetes?

I am finding docker swarm, kubernetes quite similar and then there is docker which is a company and the above two are docker clustering tool. So what exactly all these tools are and differences between them?

There are lots of articles out there which will explain the differences. In a nutshell:

  • Both are trying to solve the same problem - container orchestration over a large number of hosts. Essentially these problems can be broken down like so:
    • Scheduling containers across multiple hosts (taking into account resource utilization etc)
    • Grouping containers into logical units
    • Scaling of containers
    • Load balancing/access to these containers once they're deployed
    • Attaching storage to the containers, whether it be shared or not
    • Communication/networking between the containers/grouped containers
    • Service discovery of the containers (ie where is X service)

Both Kubernetes & Docker Swarm can solve these problems for you, but they have different naming conventions and ideas on how to solve them. The differences are relatively conceptual. There are articles that break this down quite well:

https://platform9.com/blog/compare-kubernetes-vs-docker-swarm/ https://torusware.com/blog/2016/09/hands-on-orchestration-docker-1-12-swarm-vs-kubernetes/ http://containerjournal.com/2016/04/07/kubernetes-vs-swarm-container-orchestrator-best/

Essentially, they are similar products in the same space. There are a few caveats to bear in mind though:

  • Kubernetes is developed with a container agnostic mindset (at present it supports Docker, rkt and has some support for hyper whereas docker swarm is docker only)
  • Kubernetes is "cloud native" in that it can run equally well across Azure , Google Container Engine and AWS - I am not currently aware of this being a feature of Docker Swarm, although you could configure it yourself
  • Kubernetes is an entirely open source product. If you require commercial support, you need to go to a third party to get it. Docker provides enterprise support for Swarm
  • If you are familiar with the docker-compose workflow, Docker Swarm makes use of this so it may be familiar to you and easier to get started. Kubernetes requires learning pod/service/deployment definitions which while pure yaml, are an adjustment.

Here is a one to one mapping of docker swarm with the Kubernetes.

Credits: janakiram MSV and the watch the full video here

在此处输入图片说明

Both Kubernetes & Docker Swarm offer much of the same functionalities, however, there are fundamental differences in between how the two operate. Below are the listed some of the most notable points:

Application definition

In Kubernetes, an application can be deployed using a combination of pods, deployments, and services (or micro-services).

Whereas, in Docker Swarm, applications can be deployed as services (or micro-services) in a Swarm cluster. YAML files can be used to specify multi-container. Moreover, Docker Compose can deploy the app.

Installation and set-up

In Kubernetes, installation is manual and it takes serious planning to make Kubernetes up and running. Installation instructions differ from OS to OS provider to provider. Cluster configuration like IP addresses of a node or which node takes what role is needed to know in advance in Kubernetes.

Whereas; Docker Swarm is simple to install as compared to Kubernetes. With Docker, only one set of tools are required to learn to build upon environment and configuration. Docker Swarm also provides flexibility by allowing any new node to join an existing cluster as either a manager or a worker.

Working on two systems

It requires knowing CLI (Command Line Interface) to run Kubernetes on top of Docker. You should know Docker CLI to navigate within a structure and then supplemental Kubernetes common language infrastructure to run for those programs.

Since Docker Swarm is a tool of Docker, same common language is used to navigate within a structure. This provides variability and speed to this tool and gives Docker a significant usability edge.

Logging and monitoring

Kubernetes supports multiple versions of logging and monitoring when the services are deployed within the cluster:

Elasticsearch/Kibana (ELK) logs within the container Heapster/Grafana/ Influx for monitoring in the container Sysdig cloud integration Docker Swarm is supported for only monitoring with the third-party applications. It is recommended to use Docker with Reimann for monitoring, however since Docker Swarm has an open API, it makes easier to connect with plenty of apps.

Scalability

Kubernetes is more of an all-in-one framework for distributed systems. It is a complex system as it offers a unified set of APIs and strong guarantees about the cluster state, which slows down container deployment and scaling. As compared to Kubernetes, Docker Swarm can deploy containers faster; this allows fast reaction times to scale on demand.

High availability

In Kubernetes, all pods are distributed among nodes and this provides high availability by tolerating application failure. In Kubernetes, load-balancing services detect unhealthy pods and remove them, this supports high availability.

Docker Swarm also provides high availability as services can be replicated in Swarm nodes. In Docker Swarm, Swarm manager nodes are responsible for the whole cluster and manage the resources of worker nodes.

Networking

Kubernetes network is flat, as it enables all pods to communicate with one another. In Kubernetes, the model requires two CIDRs (Classless Inter-Domain Routing). The first one requires pods to get an IP address, the other is for services.

In a Docker Swarm, a node joining a cluster creates an overlay network of services that span all of the hosts in the Swarm and a host only Docker bridge network for containers. In Docker Swarm, users have the option to encrypt container data traffic when creating an overlay network by on their own.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM