Docker Swarm, Coubernets and Composition

I just heard about native support for Kubernetes in a future version of Docker. I had never used Kubernete before, so I started reading about it. But I'm a little confused: Kubernetes is described as an instrument of orchestration , and also as an alternative to rock mode .

So, if Kubernetes does orchestration, is it also an alternative to composing dockers? Or can you compose, and use Kubernetes together?

Some specific questions: Let's say I want (or have) to use Kubernetes:

  • I have a file containing dockers containing several microservices, but they work as a separate application on the same machine. Could (or should) be replaced by Kubernet?
  • I have a file for creating a docker with several services configured in swarm mode (works on several machines). Which part need to be replaced with the Kubernet? The whole essay file? Or somehow you can define the basic configuration (env_var, volumes, command, ...) as part of the layout file and use Kubernetes only for clustering?
+5
source share
3 answers

So, if Kubernetes is doing orchestration, is it also an alternative to docker composing?

Short answer: NO

This is not just orchestration, essentially Kubernetes - it is a mechanism for orchestrating and planning production planning. It is much more advanced than docker-compose . I would say that docker swarm , Kubernetes and amazon ecs belong to the same category.

Or can you compose and use kubernets together?

In the next version of the docker engine, you can use docker-compose to create Kubernetes objects. But now you can’t.

I have a file containing dockers containing several microservices, but they work as a separate application on the same machine. Can (or should it be replaced by Kubernet?

Well, in the context of launching it in production, I would say that absolutely , you definitely need to place your applications in the Kubernetes cluster, since it provides

  • sustainability (re-planning of containers if they die)
  • scaling (scale modules based on the processor or any other indicators)
  • load balancing (provides VIP service and attaches all containers to it)
  • secrets and configuration management
  • namespaces (logical grouping of objects of the kubernetes)
  • network policies (custom policies to control traffic flow between containers)

and many other features. And when you declare Kubernetes state, you are always trying to reach and maintain that state.

I have a file for creating docker with several services configured in swarm (runs on multiple machines). Which part should be replaced by Kubernet? The whole essay file? Or is it somehow possible to determine the basic configuration (env_var, volumes, command, ...) in a compound file and use Kubernetes only for clustering?

I would replace the entire swarm cluster and compile file constructions with a Kubernetes cluster and a yaml s object yaml . Having said that in my experience, those yamls can get a verbose bit, so if you want to take a look at Helm . This is a package manager for Kubernetes that you are not using. but I think this is one of the best tools in the Kubernetes ecosystem at the moment, and there are many open source graphics available.

I would highly recommend playing with Kubernetes using minikube on your local system to familiarize yourself with the general concepts. And then you can answer the above questions for yourself.

+3
source

First of all, Kubernetes and Docker Swarm "mode" are both tools for container orchestration. Docker compose , a tool and YAML file format, has historically been a way of describing multi-container applications that are then deployed to the Docker Swarm orchestra.

Kubernetes has its own YAML service definition (and other definition file formats) that do not use the layout file format.

However, with the Docker Kubernetes support announcement, they will provide an opportunity for the Docker compose tool to also aim to collect the YAML file and deploy the β€œcontents” of this composite file (networks, services + env / secrets) to the Kubernetes cluster, with the Kubernetes orchestra engine hosting these components on K8s containers.

Based on the above statements, your questions really concern whether you want to switch to defining your services, environment, networks, etc. in Kubernetes YAML, or you would rely on Docker support to use the layout format and target Swarm or K8s. It is rather a business decision between Docker support for Kubernetes or open source or other commercial options for Kubernetes, so your questions will not necessarily have direct (and / or exactly right) answers.

+2
source

Now you can use the existing docker-linker file with Kubernetes using kompose: https://github.com/kubernetes/kompose . kompose will turn your docker services into Kubernetes objects on the fly.

The conversion may not be ideal, because there is no 1 to 1 correspondence between the docker layout scheme and Kubernetes object schemes, but it should help you along the way.

If your goal is to run on the same machine, Kubernetes is not needed. But if you used swarm mode with your file to create dockers, try kompose .

0
source

Source: https://habr.com/ru/post/1272768/


All Articles