我有一个在docker-compose上运行的网站 . 一切正常我使用Jenkins作为CI,当我提交代码时,Jenkins管理docker-compose文件到正在运行的应用程序 .
我想尝试Kubernetes并想学习它 . 我没有为docker-compose文件找到一个好的解决方案 . 我看到了Kompose,但它对我不起作用 . 然后我看到"Compose on Kubernetes"并发现这只适用于企业版 .
你如何将容器转移到Kubernetes?特别是docker-compose文件 . 我怎样才能解决Kompose错误?正如你在本文下面看到的那样,Kompose拒绝了我的项目 .
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
你可以从here.检查我的源代码
1 回答
你有几个选择 . 来自Kompose的警告是because it doesn't currently support storing data on the host所以你可以寻求解决这个问题 . 您可以使用emptyDir as a way of doing temporary storage或查看configuring hostPath,但这取决于您的目标环境 . 如果您希望部署到 Cloud 提供商,那么您最好查看其支持的存储的选项 .
另一种选择是创建一个使用official helm chart用于postgres的helm图表,也可能用于nginx,如果你不想长期使用kubernetes并希望部署描述符利用kubernetes功能并且可以部署在不同类型的kubernetes集群 .
如果你只是想在一台机器上快速运行,那么就像@ johnharris85所指出的那样,Compose on Kubernetes对你来说很有意义 .