Docker – From docker containers to Google Kubernetes

dockerkubernetes

This one is a little theoretical but please bear with me.

Currently I have a server running a few Docker containers (4 or 5, depending on day and time). I plan to add another one, just like the first, and maybe even a third one.

Now, my question is this: Should the time come that I have 15 containers to manage, instead of 5, is there any merit in using Google Kubernetes?

Also, is there an 'official', or at least 'definitive', workflow to migrate from Docker containers to 'pods', the native unit of Kubernetes. Before you ask, I do know that pods are made of containers (some times even one). My primary issue here is that 'dockerfiles' are completely different from pod configs.

Any ideas?

Best Answer

Should the time come that I have 15 containers to manage, instead of 5, is there any merit in using Google Kubernetes?

If you run containers on a single server using the Docker daemon and its Remote API sounds appropriate.

If you need to run containers on more than one server, that's where orchestration solutions like Kubernetes, Docker swarm, Fleet, Mesos, Geard becomes useful.

My primary issue here is that 'dockerfiles' are completely different from pod configs.

Because they have different purposes:

  • Dockerfile specifies how to build a container image from a tree of sources
  • pod.yaml defines how to schedule (image, command line, volumes, port) a set of co-located containers (sharing network namespace, and volumes) on one of the node of your cluster.

You can see pods as a way to declarative specify a set of docker run --net=container:... -v ... -p ... commands.

Also, is there an 'official', or at least 'definitive', workflow to migrate from Docker containers to 'pods', the native unit of Kubernetes.

There is a small tool in kubernetes/contrib called podex that allow you to generate a pod manifest from image metadata stored in the public registry.

$ go get github.com/GoogleCloudPlatform/kubernetes/contrib/podex
$ podex google/nodejs-hello
id: nodejs-hello
kind: Pod
apiVersion: v1beta1
desiredState:
  manifest:
    version: v1beta2
    containers:
    - name: nodejs-hello
      image: google/nodejs-hello
      ports:
      - name: nodejs-hello-tcp-8080
        containerPort: 8080