Kubernetes kompose

时间:2018-07-30 20:58:16

标签: docker kubernetes

嗨,我正在使用AWS EKS开发kubernetes。当我将docker-compose文件转换为kompose文件时,我对kompose文件有问题,我在卷挂载点上遇到问题,并且当我运行命令kompose时,它询问用户名我应该提供哪个凭据。 / p>

这是我的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:

1 个答案:

答案 0 :(得分:2)

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

我在Mac上使用kompose v1.16.0测试了转换,因此必须从mem_limit文件中删除docker-compose.yml选项才能成功完成。

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

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

不支持本地路径-将会创建持久卷声明(将显示警告)。 永久卷声明在默认情况下为100Mi。编辑声明的YAML文件,并在必要时增加大小。

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

kubectl create -f export/