2016-10-01 71 views
1

我有谷歌云容器引擎设置。我想用外部音量旋转mysql的pod。无法使用外部卷在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的正常工作。它下面的错误打破了,当我尝试将音量

Kubernetes POD错误:

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)" 

盘(外部音量): mysql-1-disk是谷歌云盘。我试图用blank diskimage - ubuntu创建磁盘。两者都失败了同样的错误。

+0

你解决了这个问题吗?在GCE上运行mysql时,我的结果完全相同 – VsMaX

回答

0

从我的角度来看,挂载永久磁盘上的错误消息实际上并不具有描述性。根据您的配置文件使用空白磁盘。

有些事情要检查:

  • 是在pdName完全一样,在你的CGE环境
  • 是在同一个可用性区域的磁盘(如欧洲west1-C)为您的集群,否则无法安装。

希望这会有所帮助。

0

您面临的问题可能是由于使用RC而不是Pod与Persistent Disk交互引起的。

由于它在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上面的一个RC,因为RC下来时重新启动,而pod不是。 –

相关问题