Docker-compose running on Kubernetes

12/9/2018


I have a website running on docker-compose. Everything works well I am using Jenkins as CI and when I committed code Jenkins manages docker-compose file to running app.
I want to try Kubernetes and want to learn it. I did not find a good solution for docker-compose files. I saw Kompose but it did not works for me. Then I saw "Compose on Kubernetes" and find out this is only working for enterprise version.
How do you transfer your containers to the Kubernetes? Especially docker-compose files. And how can I solve Kompose error? As you see in below this text, Kompose reject my project.

WARN Volume mount on the host "/home/fatih/Desktop/Django-DevOps-personal-website/pgdata" isn't supported - ignoring path on the host 
WARN Volume mount on the host "/home/fatih/Desktop/Django-DevOps-personal-website/config/nginx" isn't supported - ignoring path on the host 
WARN Volume mount on the host "/home/fatih/Desktop/Django-DevOps-personal-website/fatihkocnet" isn't supported - ignoring path on the host 
INFO Kubernetes file "db-service.yaml" created    
INFO Kubernetes file "nginx-ssl-proxy-service.yaml" created 
INFO Kubernetes file "web-service.yaml" created   
INFO Kubernetes file "db-deployment.yaml" created 
INFO Kubernetes file "db-claim0-persistentvolumeclaim.yaml" created 
INFO Kubernetes file "nginx-ssl-proxy-deployment.yaml" created 
INFO Kubernetes file "nginx-ssl-proxy-claim0-persistentvolumeclaim.yaml" created 
INFO Kubernetes file "nginx-ssl-proxy-claim1-persistentvolumeclaim.yaml" created 
INFO Kubernetes file "web-deployment.yaml" created 
INFO Kubernetes file "web-claim0-persistentvolumeclaim.yaml" created 

You can check my source code from here.

-- Fatih
docker
docker-compose
kubernetes

1 Answer

12/10/2018

You have a few options. The warnings from Kompose are because it doesn't currently support storing data on the host so you could look to address that. You could use emptyDir as a way of doing temporary storage or look at configuring hostPath but it depends what your target environment is. If you are looking to deploy to a cloud provider then you'd be best to look at options for their supported storage.

Another option would be to create a helm chart that uses the official helm chart for postgres and maybe also for nginx, if you don't decide to switch to nginx-ingress. This could make sense if you're looking to use kubernetes for the long-term and want a deployment descriptor that takes advantage of kubernetes features and can be deployed on different types of kubernetes cluster.

If you are just looking to have a quick way to run things on a single machine then, as @johnharris85 points out, Compose on Kubernetes would make a lot of sense for you.

-- Ryan Dawson
Source: StackOverflow