weaveworks-experiments / docker2kube

Go from a Docker image for a program that runs on a port to the simplest possible Kubernetes config for that program

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker2Kube

Go:

  • from a Docker image for a program that runs on a port
  • to the simplest possible Kubernetes config that runs that program

In more technical words:

Create a boilerplate Kubernetes deployment-service pair for a given container image.

Installing

go build
sudo cp docker2kube /usr/local/bin/docker2kube

Usage

$ cd myprogram
$ ls
Dockerfile main.go
$ docker build -t registry/myprogram:v1 .
[...]
$ docker push registry/myprogram:v1
$ cd ..
$ mkdir myprogram-config
$ git init .
$ docker2kube myprogram registry/myprogram:v1 80
$ git add *.yaml
$ git commit -am "Initial config"

What next?

Once you've pushed Kubernetes config to a git repo, the practice known as GitOps will help you get configs in version control reliably into a running application.

TODO: link to a public doc about GitOps.

About

Go from a Docker image for a program that runs on a port to the simplest possible Kubernetes config for that program

License:Apache License 2.0


Languages

Language:Go 100.0%