无法使用kompose从docker-compose转换为kubernetes

我有docker-compose安装准备好的项目。 现在我想搬到kubernetes。 我使用Kompose工具从docker-compose转换为kubernetes。

例如,这里是我的示例docker-compose.yml文件

 version: '3' volumes: database_hades_volume: external: true services: db: image: postgres:latest container_name: hades-db ports: - "5432:5432" environment: POSTGRES_DB: hades_dev POSTGRES_PASSWORD: 1234 volumes: - database_hades_volume:/var/lib/postgresql/data/ tty: true stdin_open: true redis: container_name: hades-redis image: redis:latest ports: - "6379:6379" app: container_name: hades-app build: context: . dockerfile: Dockerfile ports: - "4001:4001" volumes: - ".:/webapp" env_file: - ./.env.docker_compose-dev depends_on: - db - redis 

我已经成功运行使用命令: docker-compose up 。 现在,我使用kompose通过使用命令转换成kubernetes:

 kompose convert 

然后我运行使用:

 kompose up 

这里是命令行结果信息:

 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. INFO Deploying application in "default" namespace INFO Successfully created Service: app INFO Successfully created Service: db INFO Successfully created Service: redis INFO Successfully created Deployment: app INFO Successfully created PersistentVolumeClaim: app-claim0 of size 100Mi. If your cluster has dynamic storage provisioning, you don't have to do anything. Otherwise you have to create PersistentVolume to make PVC work INFO Successfully created Deployment: db INFO Successfully created PersistentVolumeClaim: database-hades-volume of size 100Mi. If your cluster has dynamic storage provisioning, you don't have to do anything. Otherwise you have to create PersistentVolume to make PVC work INFO Successfully created Deployment: redis Your application has been deployed to Kubernetes. You can run 'kubectl get deployment,svc,pods,pvc' for details. 

但是当我尝试去localhost:400110.0.0.180:4001进行testing时,我发现它永远在等待着。

我不知道我是否设置了错误或错过了一些步骤。 请帮帮我。

谢谢

您的docker-compose文件包含build密钥,这意味着您有app服务的源代码/ Dockerfile,截至目前,

NAME READY STATUS RESTARTS AGE po/app-2119952459-b4jtb 0/1 ErrImagePull 0 24s

状态是ErrImagePull因为集群无法find任何图像,所以随着build密钥,也提供image关键,例如。 app: container_name: hades-app build: context: . dockerfile: Dockerfile image: <username>/<imagename>:<tag>

因为,现在kompose具有本地构build和推送支持的function,因此kompose将构build您的映像,将其推送到dockerhub,然后您的群集可以在部署期间从此处拉取图像。

命令可以像,

kompose up --build=local

我希望这是有道理的