Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between Kubernetes Pods and Docker Compose(s) (Composures?)

Both Kubernetes Pods and the results of Docker Compose scripts (henceforth: "Compositions") appear to result in clusters of virtual computers.

The computers in the clusters can all be configured to talk to each other so you can write a single script that mirrors your entire end-to-end production config. A single script allows you to deploy that cluster on any container-host.

Given the similarities between the two systems, I'm struggling to understand what the differences are between the two.

Why would I choose one over the other? Are they mutually exclusive systems or can I run compositions in kubernetes.

Are there any critical considerations that need to be accounted for when designing for a container system? If I am designing the architecture for a site today and would like to try and build a container-based system. What are the highest priority things I should design for? (as compared to building on a single machine system)

like image 491
Alex C Avatar asked Nov 26 '15 19:11

Alex C


People also ask

What is the difference between Kubernetes and Docker compose?

Kubernetes and Docker Compose are both container orchestration frameworks. Kubernetes runs containers over a number of computers, virtual or real. Docker Compose runs containers on a single host machine.

What is the difference between Docker and pod?

While Docker tries to offer some workarounds to create multi-service containers, Kubernetes makes a bolder step and chooses a group of cohesive containers, called a Pod, as the smallest deployable unit.

What is the difference between POD and container in Kubernetes?

Pod is just a co-located group of container and an Kubernetes object. Instead of deploying them separate you can do deploy a pod of containers . Best practices is that you should not actually run multiple processes via single container and here is the place where pod idea comes to a place.

Is Docker compose a pod?

docker-compose uses a YAML file for describing and managing services. Normally you have create one manually. pods-compose also relies on YAML files for describing pods and containers, however you do not have to create them manually. You need to create pods and containers using the command line interface of Podman.


2 Answers

docker compose is just a way to declare the container you have to start: it has no notion of node or cluster, unless it launches swarm master and swarm nodes, but that is docker swarm)
Update July 2016, 7 months later: docker 1.12 blurs the lines and includes a "swarm mode".

It is vastly different from kubernetes, a google tool to manage thousands of containers groups as Pod, over tens or hundreds of machines.

A Kubernetes Pod would be closer from a docker swarm:

Imagine individual Docker containers as packing boxes. The boxes that need to stay together because they need to go to the same location or have an affinity to each other are loaded into shipping containers.
In this analogy, the packing boxes are Docker containers, and the shipping containers are Kubernetes pods.

As commented below by ealeon:

I think pod is equivalent to compose except that kubernetes can orchestrated pods, whereas there is nothing orchestrating compose unless it is used with swarm like you've mentioned.

You can launch kubernetes commands with docker-compose by the way.

http://3.bp.blogspot.com/-MDUsXIy-lt0/VMuhJ9jBefI/AAAAAAAAA0I/qPuy0N8UXWA/s1600/Screen%2BShot%2B2015-01-30%2Bat%2B7.19.27%2BAM.png

In terms of how Kubernetes differs from other container management systems out there, such as Swarm, Kubernetes is the third iteration of cluster managers that Google has developed.

You can hear more about kubernetes in the episode #3 of Google Cloud Platform Podcast.

While it is true both can create a multi-container application, a Pod also serves as a unit of deployment and horizontal scaling/replication, which docker compose does not provide.
Plus, you don't create a pod directly, but use controllers (like replication controllers).

POD lives within a larger platform which offers Co-location (co-scheduling), fate sharing, coordinated replication, resource sharing, and dependency management.
Docker-compose lives... on its own, with its docker-compose.yml file

like image 176
VonC Avatar answered Oct 12 '22 17:10

VonC


There's a difference with respect to networking:

  • Containers in a pod share the same IP address. From kubernetes docs:

The applications in a pod all use the same network namespace (same IP and port space), and can thus “find” each other and communicate using localhost. Because of this, applications in a pod must coordinate their usage of ports. Each pod has an IP address in a flat shared networking space that has full communication with other physical computers and pods across the network.

  • Containers in a docker-compose are assigned different IP addresses. See this blog post for more information.
like image 33
Paulo Merson Avatar answered Oct 12 '22 15:10

Paulo Merson