首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >kubernetes提出不支持的env_file密钥

kubernetes提出不支持的env_file密钥
EN

Stack Overflow用户
提问于 2018-07-25 17:41:26
回答 1查看 1.6K关注 0票数 2

我正在尝试将一个被文档化的项目迁移到kubernetes,我已经使用Kompose来转换这个项目

kompose --file docker-compose.yml convert

迁移文件后运行kompose up时,会得到以下错误

$ kompose up WARN Unsupported env_file key - ignoring

FATA Error while deploying application: k.Transform failed: image key required within build parameters in order to build and push service 'drkiq'

.env文件:

SECRET_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx WORKER_PROCESSES=1 LISTEN_ON=0.0.0.0:8000 DATABASE_URL=postgresql://drkiq:yourpassword@postgres:5432/drkiq?encoding=utf8&pool=5&timeout=5000 CACHE_URL=redis://redis:6379/0 JOB_WORKER_URL=redis://redis:6379/0

文件化项目链接这里

是否知道如何将.env文件转换为可与kubernetes kompose一起使用的格式?

码头-撰写文件:

代码语言:javascript
复制
  postgres:
    image: postgres:9.4.5
    environment:
      POSTGRES_USER: drkiq
      POSTGRES_PASSWORD: yourpassword
    ports:
      - '5432:5432'
    volumes:
      - drkiq-postgres:/var/lib/postgresql/data

  redis:
    image: redis:3.0.5
    ports:
      - '6379:6379'
    volumes:
      - drkiq-redis:/var/lib/redis/data

  drkiq:
    build: .
    links:
      - postgres
      - redis
    volumes:
      - .:/drkiq
    ports:
      - '8000:8000'
    env_file:
      - .drkiq.env
  sidekiq:
    build: .
    command: bundle exec sidekiq -C config/sidekiq.yml
    links:
      - postgres
      - redis
    volumes:
      - .:/drkiq
    env_file:
      - .drkiq.env
EN

回答 1

Stack Overflow用户

发布于 2018-07-26 11:51:41

Kubernetes kom呈支持env_file码头工人组成3.x版本的转换,正如转换矩阵中所描述的那样。

在Kubernetes中,您可以使用ConfigMap存储来自env_file的环境变量。对于SECRET_TOKEN变量,可以使用秘密保存私有和敏感数据。

您还可以为转换目的检查其他工具,如compose2kubek8s-env-gen

根据附加的Docker-composer文件和转换过程中的错误,我可以假设您丢失了drkiqsidekiq服务的图像键值:

更新:停靠-Compose.yml文件

代码语言:javascript
复制
version: '2'

services:
  postgres:
    image: postgres:9.4.5
    environment:
      POSTGRES_USER: drkiq
      POSTGRES_PASSWORD: yourpassword
    ports:
      - '5432:5432'
    volumes:
      - drkiq-postgres:/var/lib/postgresql/data

  redis:
    image: redis:3.0.5
    ports:
      - '6379:6379'
    volumes:
      - drkiq-redis:/var/lib/redis/data

  drkiq:
    build: .
    image: drkiq:tag
    links:
      - postgres
      - redis
    volumes:
      - .:/drkiq
    ports:
      - '8000:8000'
    env_file:
      - .drkiq.env
  sidekiq:
    build: .
    command: bundle exec sidekiq -C config/sidekiq.yml
    image: sidekiq:tag
    links:
      - postgres
      - redis
    volumes:
      - .:/drkiq
    env_file:
      - .drkiq.env
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51524820

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档