[英]kubernetes kompose up Unsupported env_file key
i am trying to migrate a docrized project to kubernetes, i have used Kompose to convert the project 我正在尝试将文档化的项目迁移到kubernetes,我已经使用Kompose来转换项目
kompose --file docker-compose.yml convert
, kompose --file docker-compose.yml convert
,
when i run kompose up
after migrating the files i get this error 当我在迁移文件后运行
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 file: .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
Dockerized project Link here ! Dockerized项目链接在这里 !
any idea how to convert the .env file to a format that can be used with kubernetes kompose 任何想法如何将.env文件转换为可与kubernetes kompose一起使用的格式
Docker-compose file: Docker-compose文件:
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
Kubernetes kompose supports env_file
conversion from Docker Compose 3.x version as it's described in Conversion matrix . Kubernetes kompose支持从Docker Compose 3.x版本进行
env_file
转换,如Conversion matrix中所述 。
In Kubernetes you can use ConfigMap to store your environment variables from env_file
. 在Kubernetes中,您可以使用ConfigMap从
env_file
存储环境变量。 For SECRET_TOKEN
variable, you can use Secrets to hold your private and sensitive data. 对于
SECRET_TOKEN
变量,您可以使用Secrets来保存您的私人和敏感数据。
You can also check other tools for conversion purpose like compose2kube or k8s-env-gen . 您还可以检查其他用于转换目的的工具,例如compose2kube或k8s-env-gen 。
According to the attached Docker-composer
file and the error during the conversion process, I can assume that you missed image key value for drkiq
and sidekiq
services: 根据所附的
Docker-composer
文件和转换过程中的错误,我可以假定您错过了drkiq
和sidekiq
服务的图像键值:
Update: docker-compose.yml file 更新: docker-compose.yml文件
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.