2016-10-01 20 views
1

私はGoogleのクラウドコンテナエンジンのセットアップを持っています。私は外部ボリュームでmysqlのポッドを回転させたいと思っていました。外部ボリュームのkubernetesでmysql podを実行できません

ReplicationController:

apiVersion: v1 
kind: ReplicationController 
metadata: 
    labels: 
    name: mysql 
    name: mysql-controller 
spec: 
    replicas: 1 
    template: 
    metadata: 
     labels: 
     name: mysql 
    spec: 
     containers: 
     - image: mysql 
      name: mysql 
      ports: 
      - name: mysql 
      containerPort: 3306 
      hostPort: 3306 
      volumeMounts: 
      - name: mysql-persistent-storage 
       mountPath: /var/lib/mysql 
     volumes: 
     - name: mysql-persistent-storage 
      gcePersistentDisk: 
      pdName: mysql-1-disk 
      fsType: ext4 

私はRC without外部ボリュームを実行すると、MySQLは正常に動作します。

Warning FailedSyncError syncing pod, skipping: failed to "StartContainer" for "mysql" with CrashLoopBackOff: "Back-off 20s restarting failed container=mysql pod=mysql-controller-4hhqs_default(eb34ff46-8784-11e6-8f12-42010af00162)" 

ディスク(外部ボリューム)::私はボリューム

Kubernetes PODエラーを添付しようとすると、それは以下のエラーで壊れ mysql-1-diskは、Googleのクラウドディスクです。私はblank diskimage - ubuntuの両方でディスクを作成しようとしました。どちらも同じエラーで失敗しました。

+0

問題を解決しましたか?私はGCEでmysqlを実行している間に全く同じ結果を得ています – VsMaX

答えて

0

永続ディスクをマウントする際のエラーメッセージは、私の観点からは実際には説明できません。構成ファイルに基づいて空のディスクを使用してください。

チェックするためにいくつかの点:

  • あなたのCGE環境と全く同じpdNameです、あなたのクラスタと同じアベイラビリティゾーン(例えばヨーロッパ-west1-C。)でディスクですそれ以外の場合はマウントできません。

これが役に立ちます。

0

あなたが直面する問題は、Podが永続ディスクと対話するのではなく、RCを使用することによって発生する可能性があります。

は、documentationに述べていますとおり:

この場合

A feature of PD is that they can be mounted as read-only by multiple consumers simultaneously. This means that you can pre-populate a PD with your dataset and then serve it in parallel from as many pods as you need. Unfortunately, PDs can only be mounted by a single consumer in read-write mode - no simultaneous writers allowed. Using a PD on a pod controlled by a ReplicationController will fail unless the PD is read-only or the replica count is 0 or 1.

、私はポッドの設定ファイルでディスクの接続を定義する永続ディスクでMySQLを実行するためにあなたを示唆しています。設定例はhereです。

+0

彼はレプリカ数が1であるRCを使用していますので、RCを使ってうまくいきます。私はいつもRCがPODの上にあるRCを好むでしょう。なぜなら、RCはダウン時に再起動されるから、ポッドはそうではないからです。 –

関連する問題