简体   繁体   中英

Docker-compose running on Kubernetes


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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM