2017-08-01 2 views
0

私はdocker-composeの準備ができているプロジェクトを持っています。今、私はkubernetesに移動したいです。私はKomposeツールを使用して、ドッカーの作成からkubernetesへの変換を行います。 docker-compose updocker-composeからkubernetesへの変換にkomposeを使用できません

はたとえば、ここに私のサンプル私はコマンドを使用して、正常に実行されている

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.ymlファイルです。今、私はコマンドを使用してkubernetesに変換するためのkomposeを使用します。

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:4001または10.0.0.180:4001に行って試してみると、それは永遠に待っていることがわかります。

設定が間違っているか、いくつかの手順が不足しているかどうかわかりません。私を助けてください。

おかげ

+0

は、デプロイメントを得るkubectl '実行しました意味、SVC、ポッド、pvc'を作る願って、のようにすることができますすべての配備、サービス、ポッド、量請求が準備完了状態であることを確認しますか? –

+0

これとは別に、私たちはより良い質問をすることができます。これは、初めてのkubernetesとの接触ですか?以前はドッカーの作成経験がありましたか? –

答えて

0

あなたのドッキングウィンドウ-コンファイルはあなたがappサービス、今のよう のソースコード/ Dockerfileの存在を持っていることを意味しbuildキーを含むクラスタがあるとして、

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

ステータスがErrImagePullですどの画像も見つからないので、buildキーとともにimageキーも提供してください。 app: container_name: hades-app build: context: . dockerfile: Dockerfile image: <username>/<imagename>:<tag>

今のでkomposeは、あなたのイメージを構築するためにdockerhub押すと展開しながら、あなたのクラスタは、そこからイメージを引き出すことができますkomposeローカルビルドの機能を持っており、支援を押して、 、ので。

コマンドは

kompose up --build=local

は、私が見るために、これはお勧め最後の行として

関連する問題