2017-10-02 21 views
0

sudo docker run -itd -p 50070:50070 -p 8088:8088 --name hadoop-master kiwenlau/hadoop:1.0コマンドを使用して実行できるドッカーコンテナ(Hadoopインストールhttps://github.com/kiwenlau/hadoop-cluster-docker)がありますが、同じイメージをkubernetesに展開しようとするとポッドが起動しません。ドッキングウィンドウコンテナ自体はHadoopのを起動していないことをDockerコンテナはスタンドアロンで実行されますが、kubernetesで失敗します

kubectl logs hadoop-master-2828539450-rnwsd 
* Starting OpenBSD Secure Shell server sshd 
    ...done. 

注:配置を作成するために、私は、出力をログkubectlポッドコマンドを記述

Events: 
    FirstSeen  LastSeen  Count From             SubObjectPath     Type   Reason   Message 
    ---------  --------  ----- ----             -------------     --------  ------   ------- 
    6m   6m    1  default-scheduler                  Normal   Scheduled  Successfully assigned hadoop-master-2828539450-rnwsd to gke-mtd-cluster-default-pool-6b97d4d0-hcbt 
    6m   6m    1  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal   Created   Created container with id 1560ff87e0e7357c76cec89f5f429e0b9b5fc51523c79e4e2c12df1834d7dd75 
    6m   6m    1  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal   Started   Started container with id 1560ff87e0e7357c76cec89f5f429e0b9b5fc51523c79e4e2c12df1834d7dd75 
    6m   6m    1  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal   Created   Created container with id c939d3336687a33e69d37aa73177e673fd56d766cb499a4235e89d554d233c37 
    6m   6m    1  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal   Started   Started container with id c939d3336687a33e69d37aa73177e673fd56d766cb499a4235e89d554d233c37 
    6m   6m    2  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt          Warning   FailedSync  Error syncing pod, skipping: failed to "StartContainer" for "hadoop-master" with CrashLoopBackOff: "Back-off 10s restarting failed container=hadoop-master pod=hadoop-master-2828539450-rnwsd_default(562dae39-a757-11e7-a5a3-42010a8401c6)" 

    6m 6m  1  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal Created   Created container with id 7d1c67686c039e459ee0ea3936eedb4996a5201f6a1fec02ac98d219bb07745f 
    6m 6m  1  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal Started   Started container with id 7d1c67686c039e459ee0ea3936eedb4996a5201f6a1fec02ac98d219bb07745f 
    6m 6m  2  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt          Warning FailedSync  Error syncing pod, skipping: failed to "StartContainer" for "hadoop-master" with CrashLoopBackOff: "Back-off 20s restarting failed container=hadoop-master pod=hadoop-master-2828539450-rnwsd_default(562dae39-a757-11e7-a5a3-42010a8401c6)" 

    5m 5m  1  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal Started   Started container with id a8879a2c794b3e62f788ad56e403cb619644e9219b2c092e760ddeba506b2e44 
    5m 5m  1  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal Created   Created container with id a8879a2c794b3e62f788ad56e403cb619644e9219b2c092e760ddeba506b2e44 
    5m 5m  3  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt          Warning FailedSync  Error syncing pod, skipping: failed to "StartContainer" for "hadoop-master" with CrashLoopBackOff: "Back-off 40s restarting failed container=hadoop-master pod=hadoop-master-2828539450-rnwsd_default(562dae39-a757-11e7-a5a3-42010a8401c6)" 

    5m 5m  1  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal Created   Created container with id 8907cdf19c51b87cea6e1e611649e874db2c21f47234df54bd9f27515cee0a0e 
    5m 5m  1  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal Started   Started container with id 8907cdf19c51b87cea6e1e611649e874db2c21f47234df54bd9f27515cee0a0e 
    5m 3m  7  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt          Warning FailedSync  Error syncing pod, skipping: failed to "StartContainer" for "hadoop-master" with CrashLoopBackOff: "Back-off 1m20s restarting failed container=hadoop-master pod=hadoop-master-2828539450-rnwsd_default(562dae39-a757-11e7-a5a3-42010a8401c6)" 

    3m 3m  1  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal Created   Created container with id 294072caea596b47324914a235c1882dbc521cc355644a1e25ebf06f0e04301f 
    3m 3m  1  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal Started   Started container with id 294072caea596b47324914a235c1882dbc521cc355644a1e25ebf06f0e04301f 
    3m 1m  12  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt          Warning FailedSync  Error syncing pod, skipping: failed to "StartContainer" for "hadoop-master" with CrashLoopBackOff: "Back-off 2m40s restarting failed container=hadoop-master pod=hadoop-master-2828539450-rnwsd_default(562dae39-a757-11e7-a5a3-42010a8401c6)" 

    6m 50s  7  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal Pulled   Container image "kiwenlau/hadoop:1.0" already present on machine 
    50s 50s  1  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal Created   Created container with id 7da7508ac864d04d47639b0d2c374a27c3e8a3351e13a2564e57453cf857426d 
    50s 50s  1  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Normal Started   Started container with id 7da7508ac864d04d47639b0d2c374a27c3e8a3351e13a2564e57453cf857426d 
    6m 0s  31  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt  spec.containers{hadoop-master} Warning BackOff   Back-off restarting failed container 
    49s 0s  5  kubelet, gke-mtd-cluster-default-pool-6b97d4d0-hcbt          Warning FailedSync  Error syncing pod, skipping: failed to "StartContainer" for "hadoop-master" with CrashLoopBackOff: "Back-off 5m0s restarting failed container=hadoop-master pod=hadoop-master-2828539450-rnwsd_default(562dae39-a757-11e7-a5a3-42010a8401c6)" 

のここkubectl run hadoop-master --image=kiwenlau/hadoop:1.0 --port=8088 --port=50070コマンド

ログを使用しています。それを開始するには、私はコンテナに接続して手動でハープを起動する必要がありますが、今はK8でコンテナを簡単に実行できるようにしたいと考えています。

おかげkubernetesで

+0

どのようにポッドを作成しますか?作成中にボリュームや他のオブジェクトが指定されていますか? –

+0

@MohammadMahzounコマンドkubectlを使って作成するhadoop-master --image = kiwenlau/hadoop:1.0 --port = 8088 --port = 50070 ポッド作成時にボリュームが指定されていません –

答えて

1

同等のコマンドはDockerfileで何かが間違っている、

kubectl run -it hadoop-master --image=kiwenlau/hadoop:1.0 --port=8088 --port=50070 

は実際にそれがkubernetesについてではありませんです。ジョブが終了したとして、コンテナが停止した後

A docker container exits when its main process finishes.

CMD [ "sh", "-c", "service ssh start; bash"]では、SSHサービスは、バックグラウンドで開始されます。

これは、フォアグラウンドで常に実行される実行可能なスクリプト/プログラムで、~/start-hadoop.shのようにする必要があります。

通常、docker exec -it some_container bashで十分であるため、通常はコンテナにsshは必要ありません。

+0

ありがとうございます。この問題は実際にドッカーにありましたが、hadoopにはマスターからスレーブへのsshアクセスが必要です –

関連する問題