why not create multiple containers instead of using kubernetes

12/9/2019

My understanding is Kubernetes provides scalability.

Instead of using Kubernetes, why not just create multiple containers from a docker image and bind them to different ports?

Wouldn't that serve the same result?

-- user1034912
containers
docker
docker-swarm
kubernetes

2 Answers

12/9/2019

Kubernetes provides the complete lifecycle management of the services (which happen to run multiple containers). What i have listed below is a 2 min overview, k8s does much more.

This includes

  1. Creation of replicas (as requested by user) of the services - this includes creating pods - multiple containers running in same network namespace to provide the notion of single host)

  2. Tracking the health of the containers and automatically recreating them ["Liveness Probes"]

  3. Providing the frontend virtual IP for the services and a rudimentary service discovery mechanism by providing the DNS names for the services

  4. Automatically managing the active list of service replicas to forward the requests [ "readinessProbes"]

-- pr-pal
Source: StackOverflow

12/9/2019

Scalability and fault tolerance is only a subset of the features available under Kubernetes. For the case of creating multiple containers: Kubernetes not only manages spinning up multiple instances of those containers, but it also manages the addressing, load balancing, and setting up the underlying network so even if your containers move around within the network, you can access them using the same name and address. You can think of it as a framework that sets up networking and DNS as containers are brought up and taken down. But then, that's only one of the features. Now consider if those containers have persistent storage attached to them, and when you take down one container and bring it up on another host, you have to setup the mounts on that host so the container can reach its persistent storage.

Again, these are only some of the features.

-- Burak Serdar
Source: StackOverflow