Can Kubernetes be used like Docker Compose?
I have been digging through the Kubernetes documentation for hours. I understand the core design, and the notion of services, controllers, pods, etc.
What I don’t understand, however, is the process in which I can declaratively configure the cluster. That is, a way for me to write a config file (or a set thereof) to define the makeup, and scaling options of the cloud deployment. I want to be able to declare which containers I want in which pods, how they will communicate, how they will scale, etc. without running a ton of cli commands.
Is there docker-compose functionality for Kubernetes?
I want my application to be defined in git—to be version controlled–without relying on manual cli interactions.
Is this possible to do in a concise way? Is there a reference that is more clear than the official documentation?
3 Solutions collect form web for “Can Kubernetes be used like Docker Compose?”
If you still looking, maybe this can help
using this tool
You can create compose file
web: image: nginx ports: - "80" - "443" database: image: postgres ports: - "5432" cache: image: memcached ports: - "11211"
Then use the tool to convert it to kubernetes objetcs
compose2kube -compose-file docker-compose.yml -output-dir output
Which will create those files
output/cache-rc.yaml output/database-rc.yaml output/web-rc.yaml
then you can use kubectl to apply them to kubernetes
Kubernetes certainly has its own yaml (as shown in “Deploying Applications”)
But as “Docker Clustering Tools Compared: Kubernetes vs Docker Swarm”, it was not written (just) for Docker, and it has its own system.
You could use docker-compose to start Kubernetes though, as shown in “
vyshane/kid“: that does mask some of the
kubectl commands cli in scripts (which can be versioned).
If you have existing docker composer files, you may take a look at the Kompose project https://github.com/kubernetes-incubator/kompose.