Simple Docker container cluster deployment system

7/16/2020

I am looking for a "simple" deployment system that can manage a cluster of computers.

I have one Docker image (hosted on DockerHub) that will run with different environment parameters in this cluster. For this image I have a docker_compose file that I can start on a machine directly (this works right now).

What I am looking for is a cluster management system to which I can add physical computers (nodes) and then I can issue commands like:

$ docker-compose up

or

$ docker run --device /dev/sda -e ENV1 -e ENV2 image_id

And ideally the cluster (manager) schedules it on one available node. All the nodes that I will join in the cluster have the necessary resources to run the container, so I am not interested in a cluster management system that can schedule containers depending on their hardware needs. Also, it doesn't necessarily need to have support for Docker, just to be able to issue the commands remotely on the cluster's nodes. Ideally, this would also an API other than command line that I could talk to.

What I've tried / looked at

  1. Docker swarm mode - seemed like the perfect choice, but I hit a dead-end because I use the "--device" parameter, which is not supported yet (and it might as well never be).
  2. Docker machine

Docker run image

  • this seems exactly what I want, but it's not supported anymore, so I don't think it's a good choice.
  1. Kubernetes sounds good but seems at first sight like an overkill. Also not sure it can do "--device" so I hesitate in going through learning it and hitting another dead-end.

Any suggestions are welcome!

-- Copil tembel
cluster-manager
docker
docker-swarm
kubernetes

1 Answer

7/16/2020

As it comes to kubernetes and support for something like --device in docker, this answer should dispel your doubts.

It was widely discussed in this thread on github. Although there is no exact --device equivalent in kubernetes, it's worth repeating that it's possible to use host devices in your kubernetes Pods by enabling privileged mode as suggested in this comment:

  containers:
  - name: foo
    ...
    volumeMounts:
    - mountPath: /dev/snd
      name: dev-snd
    securityContext:
      privileged: true
  volumes:
  - name: dev-snd
    hostPath:
      path: /dev/snd

It enables you to mount into your Pod any device available on specific node using hostPath and providing the divice path such as /dev/snd from the above example, enabling you to use soundcard available on the host.

You need to decide however, if running privileged containers is acceptable from security perspective in your particular case.

If you look for more secure way of mounting particular host devices that gives you more granular level of control, take a look at device plugins e.g. specific ones like the one mentioned here for exposing /dev/kvm or more general one, allowing you to configure practically any devices under host /dev into your kubernetes Pods through device cgroup.

When you're planning to run and manage your docker containers on multiple-node cluster, Kubernetes doesn't have to be an overkill, especially if you decide to use a managed solution already suggested by @DannyB in comments. It's worth mentioning that its currently available in offers of all major cloud providers: GKE on GCP, EKS on AWS or AKS on Azure, which also says a lot about its growing popularity.

Kubernetes is also very scalable and dynamically developing solution, gaining popularity quite fast in recent years, so it's definitely worth of having a closer look at it.

-- mario
Source: StackOverflow