gpt4 book ai didi

docker - Kubernetes 构成

转载 作者:行者123 更新时间:2023-12-02 11:32:00 27 4
gpt4 key购买 nike

您好,我正在使用 AWS EKS 开发 kubernetes。当我将 docker-compose 文件转换为 kompose 文件时,我遇到了 kompose 文件的问题,我遇到了卷挂载点问题,而且当我运行命令时,kompose up 它询问用户名我应该提供哪个凭据。

这是我的 docker-compose.yml

services:
cms-db:
image: mysql:5.6
volumes:
- "./shared/db:/var/lib/mysql"
restart: always
environment:
- MYSQL_DATABASE=cms
- MYSQL_USER=cms
- MYSQL_RANDOM_ROOT_PASSWORD=yes
mem_limit: 1g
env_file: config.env
cms-xmr:
image: xibosignage/xibo-xmr:release-0.7
ports:
- "9505:9505"
restart: always
mem_limit: 256m
env_file: config.env
cms-web:
image: xibosignage/xibo-cms:release-1.8.10
volumes:
- "./shared/cms/custom:/var/www/cms/custom"
- "./shared/backup:/var/www/backup"
- "./shared/cms/web/theme/custom:/var/www/cms/web/theme/custom"
- "./shared/cms/library:/var/www/cms/library"
- "./shared/cms/web/userscripts:/var/www/cms/web/userscripts"
restart: always
links:
- cms-db:mysql
- cms-xmr:50001
environment:
- XMR_HOST=cms-xmr
env_file: config.env
ports:
- "80:80"
mem_limit: 1g


[root@my-ip xibo-docker-1.8.10]# kompose up
WARN Unsupported env_file key - ignoring
WARN Unsupported links key - ignoring
WARN Volume mount on the host "./shared/db" isn't supported - ignoring path on the host
WARN Volume mount on the host "./shared/cms/custom" isn't supported - ignoring path on the host
WARN Volume mount on the host "./shared/backup" isn't supported - ignoring path on the host
WARN Volume mount on the host "./shared/cms/web/theme/custom" isn't supported - ignoring path on the host
WARN Volume mount on the host "./shared/cms/library" isn't supported - ignoring path on the host
WARN Volume mount on the host "./shared/cms/web/userscripts" isn't supported - ignoring path on the host
INFO We are going to create Kubernetes Deployments, Services and PersistentVolumeClaims for your Dockerized application. If you need different kind of resources, use the 'kompose convert' and 'kubectl create -f' commands instead.

Please enter Username:

最佳答案

将配置应用到 Kubernetes 集群的更好方法是转换它,检查 YAML 文件,必要时调整它们,然后使用 kubectl 应用它们。

我在 Mac 上使用 kompose v1.16.0 测试了转换,我不得不从 docker-compose.yml 中删除 mem_limit 选项文件以成功完成它。

$ mkdir export
$ kompose -v convert -f docker-compose.yml -o export

将在 export 目录中创建 14 个文件。

不支持本地路径 - 将改为创建持久卷声明(将出现警告)。持久卷声明默认为 100Mi。编辑声明 YAML 文件并在必要时增加大小。

现在您可以使用以下方式将您的配置部署到 Kubernetes 集群:

kubectl create -f export/

关于docker - Kubernetes 构成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51602191/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com