Kompose
Note
For more background information, make sure to check out the demos overview page.
This demo shows kompose1 workflows to translate docker-compose files to kubernetes manifests, plus interacting with the services from inside kubernetes and without kubernetes. As with other demos, batteries are included and this automation comes with optional cluster lifecycle management. But it works with any other KUBECONFIG if you brought your own cluster.
This setup is great for prototyping, since it's basically providing modular "local-first" development and cluster-backed deployments using the same datastructure. Your project might eventually grow to include docker registries, helm charts and repos, and dozens of files.. but all of that overhead is really awkward when you're just getting started.
The kompose tool converts docker-compose files directly to kubernetes manifests, based on a few hints in the labels and command-line arguments. And our upstream automation framework (i.e. compose.mk) happens to specialize in integrating with docker compose .
Let's see if we can make a self-contained example that's easy to extend2.
Basic Usage
Running the demo is simple:
# Default entrypoint runs clean, create,
# deploy, test, but does not tear down the cluster.
$ ./demos/cmk/kompose.cmk
Interactive Workflows
# End-to-end, again without teardown
$ ./demos/cmk/kompose.cmk clean build create deploy test
Source Code
The source code below uses containers from the toolbox and primitives from the k8s.mk API. Since k8s.mk is built on top of compose.mk, you might want some of that background to completely understand the demo, but for the most part it should be pretty easy to read and adapt.
