Is it possible to run docker-compose projects inside kubernetes?
Hello, I've some old projects that I'd like to maintain along new ones in my kubernetes cluster. I thought that the easiest way of doing that might be running said project inside one pod (docker in docker). Is that doable? Google searches don't yield any results, so there have to be some roadblocks :P I don't care about HA for those projects and just want to maintain one infrastructure instead of multiple ones.
EDIT. Thanks for the answers guys, I guess I'll spend some time to properly convert those compose files. Thanks for taking time to answer. Cheers :-)
You can easily convert the docker-compose file to native kubernetes resources. Check this out: https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/
I've tried kompose in one project and had some issues with it (don't really remember what was the problem, I think not all compose fields are easily translatable to kubernetes objects). I guess I'll look into it again to see if it works for those projects.
If you are running in Kubernetes, you need to speak in the language where HA is possible. So all the assumptions of running on one node become problematic (storage, network, etc). And places where you could force it to not be HA are not best practices Or are complicated or brittle, like tying to a specific node for local storage.
You could run Docker Compose style on the same container engine running your k8s, like with nerdctl. But that seems icky.
But in the end, if you are looking for simplicity. Rethinking the assumptions made with Docker Compose in the new syntax is going to work out a lot better in the long run. Kompose gets you most of the way there and where it doesn't work are the places that need human thought about how you are running your k8s architecture.
There is a project that converts docker-compose files to Kubernetes files. I tried it a year ago, but wasn't working so well for me, especially local files. The name is Kompose
Yea that was my experience with Kompose as well, that's why I thought maybe it's possible to just run compose inside pod without any translation :P
Just like you I've tried it some time ago, maybe it'll work better this time.
Why is this marked NSFW?
It's so bad it's nearly pornographic.
Yea, compose inside kubernetes cluster deserves NSFW
ACORN
The work it would take ChatGPT to convert your compose to a working group of k8s manifest is so small it’s concerning you’d choose such an anti pattern.